use :: libc;
extern "C" {
    pub type _IO_wide_data;
    pub type _IO_codecvt;
    pub type _IO_marker;
    pub type event_base;
    pub type evbuffer;
    pub type bufferevent_ops;
    pub type args;
    pub type tmuxpeer;
    pub type hyperlinks;
    pub type screen_write_cline;
    pub type screen_sel;
    pub type screen_titles;
    pub type environ;
    pub type options;
    pub type format_tree;
    pub type input_ctx;
    pub type cmds;
    pub type tty_key;
    pub type tty_code;
    pub type format_job_tree;
    pub type control_state;
    pub type cmdq_list;
    pub type cmd;
    pub type cmdq_item;
    pub type cmdq_state;
    fn __ctype_b_loc() -> *mut *const u16;
    fn getpwuid(__uid: __uid_t) -> *mut passwd;
    fn getpwnam(__name: *const i8) -> *mut passwd;
    fn realloc(_: *mut libc::c_void, _: u64) -> *mut libc::c_void;
    fn free(_: *mut libc::c_void);
    fn wctomb(__s: *mut i8, __wchar: wchar_t) -> i32;
    fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: u64) -> *mut libc::c_void;
    fn memset(_: *mut libc::c_void, _: i32, _: u64) -> *mut libc::c_void;
    fn strcmp(_: *const i8, _: *const i8) -> i32;
    fn strchr(_: *const i8, _: i32) -> *mut i8;
    fn strlen(_: *const i8) -> u64;
    fn getuid() -> __uid_t;
    fn sscanf(_: *const i8, _: *const i8, _: ...) -> i32;
    fn getc(__stream: *mut FILE) -> i32;
    fn ungetc(__c: i32, __stream: *mut FILE) -> i32;
    fn xmalloc(_: size_t) -> *mut libc::c_void;
    fn xcalloc(_: size_t, _: size_t) -> *mut libc::c_void;
    fn xrealloc(_: *mut libc::c_void, _: size_t) -> *mut libc::c_void;
    fn xrecallocarray(_: *mut libc::c_void, _: size_t, _: size_t, _: size_t) -> *mut libc::c_void;
    fn xstrdup(_: *const i8) -> *mut i8;
    fn xasprintf(_: *mut *mut i8, _: *const i8, _: ...) -> i32;
    fn xvasprintf(_: *mut *mut i8, _: *const i8, _: ::core::ffi::VaList) -> i32;
    static mut global_environ: *mut environ;
    fn format_true(_: *const i8) -> i32;
    fn format_create(_: *mut client, _: *mut cmdq_item, _: i32, _: i32) -> *mut format_tree;
    fn format_free(_: *mut format_tree);
    fn format_expand(_: *mut format_tree, _: *const i8) -> *mut i8;
    fn environ_find(_: *mut environ, _: *const i8) -> *mut environ_entry;
    fn environ_put(_: *mut environ, _: *const i8, _: i32);
    fn args_free_value(_: *mut args_value);
    fn cmd_find_valid_state(_: *mut cmd_find_state) -> i32;
    fn cmd_find_from_client(_: *mut cmd_find_state, _: *mut client, _: i32) -> i32;
    fn cmd_get_alias(_: *const i8) -> *mut i8;
    fn cmd_parse(_: *mut args_value, _: u_int, _: *const i8, _: u_int, _: *mut *mut i8)
        -> *mut cmd;
    fn cmd_list_new() -> *mut cmd_list;
    fn cmd_list_append(_: *mut cmd_list, _: *mut cmd);
    fn cmd_list_append_all(_: *mut cmd_list, _: *mut cmd_list);
    fn cmd_list_move(_: *mut cmd_list, _: *mut cmd_list);
    fn cmd_list_free(_: *mut cmd_list);
    fn cmd_list_print(_: *mut cmd_list, _: i32) -> *mut i8;
    fn cmdq_print(_: *mut cmdq_item, _: *const i8, _: ...);
    fn format_defaults(
        _: *mut format_tree,
        _: *mut client,
        _: *mut session,
        _: *mut winlink,
        _: *mut window_pane,
    );
    fn cmdq_insert_after(_: *mut cmdq_item, _: *mut cmdq_item) -> *mut cmdq_item;
    fn cmdq_get_command(_: *mut cmd_list, _: *mut cmdq_state) -> *mut cmdq_item;
    fn cmdq_append(_: *mut client, _: *mut cmdq_item) -> *mut cmdq_item;
    fn log_debug(_: *const i8, _: ...);
    fn fatalx(_: *const i8, _: ...) -> !;
}
pub type __builtin_va_list = [__va_list_tag; 1];
#[derive(Copy, Clone)]
#[repr(C)]
pub struct __va_list_tag {
    pub gp_offset: u32,
    pub fp_offset: u32,
    pub overflow_arg_area: *mut libc::c_void,
    pub reg_save_area: *mut libc::c_void,
}
pub type __u_char = u8;
pub type __u_short = u16;
pub type __u_int = u32;
pub type __uint8_t = u8;
pub type __uint64_t = u64;
pub type __uid_t = u32;
pub type __gid_t = u32;
pub type __off_t = i64;
pub type __off64_t = i64;
pub type __pid_t = i32;
pub type __time_t = i64;
pub type __suseconds_t = i64;
pub type u_char = __u_char;
pub type u_short = __u_short;
pub type u_int = __u_int;
pub type pid_t = __pid_t;
pub type time_t = __time_t;
pub type size_t = u64;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct timeval {
    pub tv_sec: __time_t,
    pub tv_usec: __suseconds_t,
}
pub type C2RustUnnamed = u32;
pub const _ISalnum: C2RustUnnamed = 8;
pub const _ISpunct: C2RustUnnamed = 4;
pub const _IScntrl: C2RustUnnamed = 2;
pub const _ISblank: C2RustUnnamed = 1;
pub const _ISgraph: C2RustUnnamed = 32768;
pub const _ISprint: C2RustUnnamed = 16384;
pub const _ISspace: C2RustUnnamed = 8192;
pub const _ISxdigit: C2RustUnnamed = 4096;
pub const _ISdigit: C2RustUnnamed = 2048;
pub const _ISalpha: C2RustUnnamed = 1024;
pub const _ISlower: C2RustUnnamed = 512;
pub const _ISupper: C2RustUnnamed = 256;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct passwd {
    pub pw_name: *mut i8,
    pub pw_passwd: *mut i8,
    pub pw_uid: __uid_t,
    pub pw_gid: __gid_t,
    pub pw_gecos: *mut i8,
    pub pw_dir: *mut i8,
    pub pw_shell: *mut i8,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct _IO_FILE {
    pub _flags: i32,
    pub _IO_read_ptr: *mut i8,
    pub _IO_read_end: *mut i8,
    pub _IO_read_base: *mut i8,
    pub _IO_write_base: *mut i8,
    pub _IO_write_ptr: *mut i8,
    pub _IO_write_end: *mut i8,
    pub _IO_buf_base: *mut i8,
    pub _IO_buf_end: *mut i8,
    pub _IO_save_base: *mut i8,
    pub _IO_backup_base: *mut i8,
    pub _IO_save_end: *mut i8,
    pub _markers: *mut _IO_marker,
    pub _chain: *mut _IO_FILE,
    pub _fileno: i32,
    pub _flags2: i32,
    pub _old_offset: __off_t,
    pub _cur_column: u16,
    pub _vtable_offset: i8,
    pub _shortbuf: [i8; 1],
    pub _lock: *mut libc::c_void,
    pub _offset: __off64_t,
    pub _codecvt: *mut _IO_codecvt,
    pub _wide_data: *mut _IO_wide_data,
    pub _freeres_list: *mut _IO_FILE,
    pub _freeres_buf: *mut libc::c_void,
    pub __pad5: size_t,
    pub _mode: i32,
    pub _unused2: [i8; 20],
}
pub type _IO_lock_t = ();
pub type FILE = _IO_FILE;
pub type wchar_t = i32;
pub type va_list = __builtin_va_list;
pub type cc_t = u8;
pub type speed_t = u32;
pub type tcflag_t = u32;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct termios {
    pub c_iflag: tcflag_t,
    pub c_oflag: tcflag_t,
    pub c_cflag: tcflag_t,
    pub c_lflag: tcflag_t,
    pub c_line: cc_t,
    pub c_cc: [cc_t; 32],
    pub c_ispeed: speed_t,
    pub c_ospeed: speed_t,
}
pub type uint8_t = __uint8_t;
pub type uint64_t = __uint64_t;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event {
    pub ev_evcallback: event_callback,
    pub ev_timeout_pos: C2RustUnnamed_5,
    pub ev_fd: i32,
    pub ev_base: *mut event_base,
    pub ev_: C2RustUnnamed_0,
    pub ev_events: i16,
    pub ev_res: i16,
    pub ev_timeout: timeval,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_0 {
    pub ev_io: C2RustUnnamed_3,
    pub ev_signal: C2RustUnnamed_1,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_1 {
    pub ev_signal_next: C2RustUnnamed_2,
    pub ev_ncalls: i16,
    pub ev_pncalls: *mut i16,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_2 {
    pub le_next: *mut event,
    pub le_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_3 {
    pub ev_io_next: C2RustUnnamed_4,
    pub ev_timeout: timeval,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_4 {
    pub le_next: *mut event,
    pub le_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_5 {
    pub ev_next_with_common_timeout: C2RustUnnamed_6,
    pub min_heap_idx: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_6 {
    pub tqe_next: *mut event,
    pub tqe_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event_callback {
    pub evcb_active_next: C2RustUnnamed_8,
    pub evcb_flags: i16,
    pub evcb_pri: uint8_t,
    pub evcb_closure: uint8_t,
    pub evcb_cb_union: C2RustUnnamed_7,
    pub evcb_arg: *mut libc::c_void,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_7 {
    pub evcb_callback: Option<unsafe extern "C" fn(i32, i16, *mut libc::c_void) -> ()>,
    pub evcb_selfcb: Option<unsafe extern "C" fn(*mut event_callback, *mut libc::c_void) -> ()>,
    pub evcb_evfinalize: Option<unsafe extern "C" fn(*mut event, *mut libc::c_void) -> ()>,
    pub evcb_cbfinalize: Option<unsafe extern "C" fn(*mut event_callback, *mut libc::c_void) -> ()>,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_8 {
    pub tqe_next: *mut event_callback,
    pub tqe_prev: *mut *mut event_callback,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct bufferevent {
    pub ev_base: *mut event_base,
    pub be_ops: *const bufferevent_ops,
    pub ev_read: event,
    pub ev_write: event,
    pub input: *mut evbuffer,
    pub output: *mut evbuffer,
    pub wm_read: event_watermark,
    pub wm_write: event_watermark,
    pub readcb: bufferevent_data_cb,
    pub writecb: bufferevent_data_cb,
    pub errorcb: bufferevent_event_cb,
    pub cbarg: *mut libc::c_void,
    pub timeout_read: timeval,
    pub timeout_write: timeval,
    pub enabled: i16,
}
pub type bufferevent_event_cb =
    Option<unsafe extern "C" fn(*mut bufferevent, i16, *mut libc::c_void) -> ()>;
pub type bufferevent_data_cb =
    Option<unsafe extern "C" fn(*mut bufferevent, *mut libc::c_void) -> ()>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event_watermark {
    pub low: size_t,
    pub high: size_t,
}
pub type bitstr_t = u8;
pub type msgtype = u32;
pub const MSG_READ_CANCEL: msgtype = 307;
pub const MSG_WRITE_CLOSE: msgtype = 306;
pub const MSG_WRITE_READY: msgtype = 305;
pub const MSG_WRITE: msgtype = 304;
pub const MSG_WRITE_OPEN: msgtype = 303;
pub const MSG_READ_DONE: msgtype = 302;
pub const MSG_READ: msgtype = 301;
pub const MSG_READ_OPEN: msgtype = 300;
pub const MSG_FLAGS: msgtype = 218;
pub const MSG_EXEC: msgtype = 217;
pub const MSG_WAKEUP: msgtype = 216;
pub const MSG_UNLOCK: msgtype = 215;
pub const MSG_SUSPEND: msgtype = 214;
pub const MSG_OLDSTDOUT: msgtype = 213;
pub const MSG_OLDSTDIN: msgtype = 212;
pub const MSG_OLDSTDERR: msgtype = 211;
pub const MSG_SHUTDOWN: msgtype = 210;
pub const MSG_SHELL: msgtype = 209;
pub const MSG_RESIZE: msgtype = 208;
pub const MSG_READY: msgtype = 207;
pub const MSG_LOCK: msgtype = 206;
pub const MSG_EXITING: msgtype = 205;
pub const MSG_EXITED: msgtype = 204;
pub const MSG_EXIT: msgtype = 203;
pub const MSG_DETACHKILL: msgtype = 202;
pub const MSG_DETACH: msgtype = 201;
pub const MSG_COMMAND: msgtype = 200;
pub const MSG_IDENTIFY_TERMINFO: msgtype = 112;
pub const MSG_IDENTIFY_LONGFLAGS: msgtype = 111;
pub const MSG_IDENTIFY_STDOUT: msgtype = 110;
pub const MSG_IDENTIFY_FEATURES: msgtype = 109;
pub const MSG_IDENTIFY_CWD: msgtype = 108;
pub const MSG_IDENTIFY_CLIENTPID: msgtype = 107;
pub const MSG_IDENTIFY_DONE: msgtype = 106;
pub const MSG_IDENTIFY_ENVIRON: msgtype = 105;
pub const MSG_IDENTIFY_STDIN: msgtype = 104;
pub const MSG_IDENTIFY_OLDCWD: msgtype = 103;
pub const MSG_IDENTIFY_TTYNAME: msgtype = 102;
pub const MSG_IDENTIFY_TERM: msgtype = 101;
pub const MSG_IDENTIFY_FLAGS: msgtype = 100;
pub const MSG_VERSION: msgtype = 12;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client {
    pub name: *const i8,
    pub peer: *mut tmuxpeer,
    pub queue: *mut cmdq_list,
    pub windows: client_windows,
    pub control_state: *mut control_state,
    pub pause_age: u_int,
    pub pid: pid_t,
    pub fd: i32,
    pub out_fd: i32,
    pub event: event,
    pub retval: i32,
    pub creation_time: timeval,
    pub activity_time: timeval,
    pub last_activity_time: timeval,
    pub environ: *mut environ,
    pub jobs: *mut format_job_tree,
    pub title: *mut i8,
    pub path: *mut i8,
    pub cwd: *const i8,
    pub term_name: *mut i8,
    pub term_features: i32,
    pub term_type: *mut i8,
    pub term_caps: *mut *mut i8,
    pub term_ncaps: u_int,
    pub ttyname: *mut i8,
    pub tty: tty,
    pub written: size_t,
    pub discarded: size_t,
    pub redraw: size_t,
    pub repeat_timer: event,
    pub click_timer: event,
    pub click_button: u_int,
    pub click_event: mouse_event,
    pub status: status_line,
    pub flags: uint64_t,
    pub exit_type: C2RustUnnamed_31,
    pub exit_msgtype: msgtype,
    pub exit_session: *mut i8,
    pub exit_message: *mut i8,
    pub keytable: *mut key_table,
    pub last_key: key_code,
    pub redraw_panes: uint64_t,
    pub redraw_scrollbars: uint64_t,
    pub message_ignore_keys: i32,
    pub message_ignore_styles: i32,
    pub message_string: *mut i8,
    pub message_timer: event,
    pub prompt_string: *mut i8,
    pub prompt_buffer: *mut utf8_data,
    pub prompt_last: *mut i8,
    pub prompt_index: size_t,
    pub prompt_inputcb: prompt_input_cb,
    pub prompt_freecb: prompt_free_cb,
    pub prompt_data: *mut libc::c_void,
    pub prompt_hindex: [u_int; 4],
    pub prompt_mode: C2RustUnnamed_28,
    pub prompt_saved: *mut utf8_data,
    pub prompt_flags: i32,
    pub prompt_type: prompt_type,
    pub prompt_cursor: i32,
    pub session: *mut session,
    pub last_session: *mut session,
    pub references: i32,
    pub pan_window: *mut libc::c_void,
    pub pan_ox: u_int,
    pub pan_oy: u_int,
    pub overlay_check: overlay_check_cb,
    pub overlay_mode: overlay_mode_cb,
    pub overlay_draw: overlay_draw_cb,
    pub overlay_key: overlay_key_cb,
    pub overlay_free: overlay_free_cb,
    pub overlay_resize: overlay_resize_cb,
    pub overlay_data: *mut libc::c_void,
    pub overlay_timer: event,
    pub files: client_files,
    pub clipboard_panes: *mut u_int,
    pub clipboard_npanes: u_int,
    pub entry: C2RustUnnamed_9,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_9 {
    pub tqe_next: *mut client,
    pub tqe_prev: *mut *mut client,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_files {
    pub rbh_root: *mut client_file,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_file {
    pub c: *mut client,
    pub peer: *mut tmuxpeer,
    pub tree: *mut client_files,
    pub references: i32,
    pub stream: i32,
    pub path: *mut i8,
    pub buffer: *mut evbuffer,
    pub event: *mut bufferevent,
    pub fd: i32,
    pub error: i32,
    pub closed: i32,
    pub cb: client_file_cb,
    pub data: *mut libc::c_void,
    pub entry: C2RustUnnamed_10,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_10 {
    pub rbe_left: *mut client_file,
    pub rbe_right: *mut client_file,
    pub rbe_parent: *mut client_file,
    pub rbe_color: i32,
}
pub type client_file_cb = Option<
    unsafe extern "C" fn(*mut client, *const i8, i32, i32, *mut evbuffer, *mut libc::c_void) -> (),
>;
pub type overlay_resize_cb = Option<unsafe extern "C" fn(*mut client, *mut libc::c_void) -> ()>;
pub type overlay_free_cb = Option<unsafe extern "C" fn(*mut client, *mut libc::c_void) -> ()>;
pub type overlay_key_cb =
    Option<unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut key_event) -> i32>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_event {
    pub key: key_code,
    pub m: mouse_event,
    pub buf: *mut i8,
    pub len: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct mouse_event {
    pub valid: i32,
    pub ignore: i32,
    pub key: key_code,
    pub statusat: i32,
    pub statuslines: u_int,
    pub x: u_int,
    pub y: u_int,
    pub b: u_int,
    pub lx: u_int,
    pub ly: u_int,
    pub lb: u_int,
    pub ox: u_int,
    pub oy: u_int,
    pub s: i32,
    pub w: i32,
    pub wp: i32,
    pub sgr_type: u_int,
    pub sgr_b: u_int,
}
pub type key_code = u64;
pub type overlay_draw_cb =
    Option<unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut screen_redraw_ctx) -> ()>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct screen_redraw_ctx {
    pub c: *mut client,
    pub statuslines: u_int,
    pub statustop: i32,
    pub pane_status: i32,
    pub pane_lines: pane_lines,
    pub pane_scrollbars: i32,
    pub pane_scrollbars_pos: i32,
    pub no_pane_gc: grid_cell,
    pub no_pane_gc_set: i32,
    pub sx: u_int,
    pub sy: u_int,
    pub ox: u_int,
    pub oy: u_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid_cell {
    pub data: utf8_data,
    pub attr: u_short,
    pub flags: u_char,
    pub fg: i32,
    pub bg: i32,
    pub us: i32,
    pub link: u_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct utf8_data {
    pub data: [u_char; 21],
    pub have: u_char,
    pub size: u_char,
    pub width: u_char,
}
pub type pane_lines = u32;
pub const PANE_LINES_NUMBER: pane_lines = 4;
pub const PANE_LINES_SIMPLE: pane_lines = 3;
pub const PANE_LINES_HEAVY: pane_lines = 2;
pub const PANE_LINES_DOUBLE: pane_lines = 1;
pub const PANE_LINES_SINGLE: pane_lines = 0;
pub type overlay_mode_cb = Option<
    unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut u_int, *mut u_int) -> *mut screen,
>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct screen {
    pub title: *mut i8,
    pub path: *mut i8,
    pub titles: *mut screen_titles,
    pub grid: *mut grid,
    pub cx: u_int,
    pub cy: u_int,
    pub cstyle: screen_cursor_style,
    pub default_cstyle: screen_cursor_style,
    pub ccolour: i32,
    pub default_ccolour: i32,
    pub rupper: u_int,
    pub rlower: u_int,
    pub mode: i32,
    pub default_mode: i32,
    pub saved_cx: u_int,
    pub saved_cy: u_int,
    pub saved_grid: *mut grid,
    pub saved_cell: grid_cell,
    pub saved_flags: i32,
    pub tabs: *mut bitstr_t,
    pub sel: *mut screen_sel,
    pub write_list: *mut screen_write_cline,
    pub hyperlinks: *mut hyperlinks,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid {
    pub flags: i32,
    pub sx: u_int,
    pub sy: u_int,
    pub hscrolled: u_int,
    pub hsize: u_int,
    pub hlimit: u_int,
    pub linedata: *mut grid_line,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid_line {
    pub celldata: *mut grid_cell_entry,
    pub cellused: u_int,
    pub cellsize: u_int,
    pub extddata: *mut grid_extd_entry,
    pub extdsize: u_int,
    pub flags: i32,
    pub time: time_t,
}
#[derive(Copy, Clone)]
#[repr(C, packed)]
pub struct grid_extd_entry {
    pub data: utf8_char,
    pub attr: u_short,
    pub flags: u_char,
    pub fg: i32,
    pub bg: i32,
    pub us: i32,
    pub link: u_int,
}
pub type utf8_char = u_int;
#[derive(Copy, Clone)]
#[repr(C, packed)]
pub struct grid_cell_entry {
    pub c2rust_unnamed: C2RustUnnamed_11,
    pub flags: u_char,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_11 {
    pub offset: u_int,
    pub data: C2RustUnnamed_12,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_12 {
    pub attr: u_char,
    pub fg: u_char,
    pub bg: u_char,
    pub data: u_char,
}
pub type screen_cursor_style = u32;
pub const SCREEN_CURSOR_BAR: screen_cursor_style = 3;
pub const SCREEN_CURSOR_UNDERLINE: screen_cursor_style = 2;
pub const SCREEN_CURSOR_BLOCK: screen_cursor_style = 1;
pub const SCREEN_CURSOR_DEFAULT: screen_cursor_style = 0;
pub type overlay_check_cb = Option<
    unsafe extern "C" fn(
        *mut client,
        *mut libc::c_void,
        u_int,
        u_int,
        u_int,
        *mut overlay_ranges,
    ) -> (),
>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct overlay_ranges {
    pub px: [u_int; 3],
    pub nx: [u_int; 3],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct session {
    pub id: u_int,
    pub name: *mut i8,
    pub cwd: *const i8,
    pub creation_time: timeval,
    pub last_attached_time: timeval,
    pub activity_time: timeval,
    pub last_activity_time: timeval,
    pub lock_timer: event,
    pub curw: *mut winlink,
    pub lastw: winlink_stack,
    pub windows: winlinks,
    pub statusat: i32,
    pub statuslines: u_int,
    pub options: *mut options,
    pub flags: i32,
    pub attached: u_int,
    pub tio: *mut termios,
    pub environ: *mut environ,
    pub references: i32,
    pub gentry: C2RustUnnamed_14,
    pub entry: C2RustUnnamed_13,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_13 {
    pub rbe_left: *mut session,
    pub rbe_right: *mut session,
    pub rbe_parent: *mut session,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_14 {
    pub tqe_next: *mut session,
    pub tqe_prev: *mut *mut session,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlinks {
    pub rbh_root: *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlink {
    pub idx: i32,
    pub session: *mut session,
    pub window: *mut window,
    pub flags: i32,
    pub entry: C2RustUnnamed_17,
    pub wentry: C2RustUnnamed_16,
    pub sentry: C2RustUnnamed_15,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_15 {
    pub tqe_next: *mut winlink,
    pub tqe_prev: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_16 {
    pub tqe_next: *mut winlink,
    pub tqe_prev: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_17 {
    pub rbe_left: *mut winlink,
    pub rbe_right: *mut winlink,
    pub rbe_parent: *mut winlink,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window {
    pub id: u_int,
    pub latest: *mut libc::c_void,
    pub name: *mut i8,
    pub name_event: event,
    pub name_time: timeval,
    pub alerts_timer: event,
    pub offset_timer: event,
    pub activity_time: timeval,
    pub active: *mut window_pane,
    pub last_panes: window_panes,
    pub panes: window_panes,
    pub lastlayout: i32,
    pub layout_root: *mut layout_cell,
    pub saved_layout_root: *mut layout_cell,
    pub old_layout: *mut i8,
    pub sx: u_int,
    pub sy: u_int,
    pub manual_sx: u_int,
    pub manual_sy: u_int,
    pub xpixel: u_int,
    pub ypixel: u_int,
    pub new_sx: u_int,
    pub new_sy: u_int,
    pub new_xpixel: u_int,
    pub new_ypixel: u_int,
    pub fill_character: *mut utf8_data,
    pub flags: i32,
    pub alerts_queued: i32,
    pub alerts_entry: C2RustUnnamed_20,
    pub options: *mut options,
    pub references: u_int,
    pub winlinks: C2RustUnnamed_19,
    pub entry: C2RustUnnamed_18,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_18 {
    pub rbe_left: *mut window,
    pub rbe_right: *mut window,
    pub rbe_parent: *mut window,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_19 {
    pub tqh_first: *mut winlink,
    pub tqh_last: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_20 {
    pub tqe_next: *mut window,
    pub tqe_prev: *mut *mut window,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct layout_cell {
    pub type_0: layout_type,
    pub parent: *mut layout_cell,
    pub sx: u_int,
    pub sy: u_int,
    pub xoff: u_int,
    pub yoff: u_int,
    pub wp: *mut window_pane,
    pub cells: layout_cells,
    pub entry: C2RustUnnamed_21,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_21 {
    pub tqe_next: *mut layout_cell,
    pub tqe_prev: *mut *mut layout_cell,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct layout_cells {
    pub tqh_first: *mut layout_cell,
    pub tqh_last: *mut *mut layout_cell,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane {
    pub id: u_int,
    pub active_point: u_int,
    pub window: *mut window,
    pub options: *mut options,
    pub layout_cell: *mut layout_cell,
    pub saved_layout_cell: *mut layout_cell,
    pub sx: u_int,
    pub sy: u_int,
    pub xoff: u_int,
    pub yoff: u_int,
    pub flags: i32,
    pub sb_slider_y: u_int,
    pub sb_slider_h: u_int,
    pub argc: i32,
    pub argv: *mut *mut i8,
    pub shell: *mut i8,
    pub cwd: *mut i8,
    pub pid: pid_t,
    pub tty: [i8; 32],
    pub status: i32,
    pub dead_time: timeval,
    pub fd: i32,
    pub event: *mut bufferevent,
    pub offset: window_pane_offset,
    pub base_offset: size_t,
    pub resize_queue: window_pane_resizes,
    pub resize_timer: event,
    pub ictx: *mut input_ctx,
    pub cached_gc: grid_cell,
    pub cached_active_gc: grid_cell,
    pub palette: colour_palette,
    pub pipe_fd: i32,
    pub pipe_event: *mut bufferevent,
    pub pipe_offset: window_pane_offset,
    pub screen: *mut screen,
    pub base: screen,
    pub status_screen: screen,
    pub status_size: size_t,
    pub modes: C2RustUnnamed_25,
    pub searchstr: *mut i8,
    pub searchregex: i32,
    pub border_gc_set: i32,
    pub border_gc: grid_cell,
    pub control_bg: i32,
    pub control_fg: i32,
    pub scrollbar_style: style,
    pub entry: C2RustUnnamed_24,
    pub sentry: C2RustUnnamed_23,
    pub tree_entry: C2RustUnnamed_22,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_22 {
    pub rbe_left: *mut window_pane,
    pub rbe_right: *mut window_pane,
    pub rbe_parent: *mut window_pane,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_23 {
    pub tqe_next: *mut window_pane,
    pub tqe_prev: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_24 {
    pub tqe_next: *mut window_pane,
    pub tqe_prev: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style {
    pub gc: grid_cell,
    pub ignore: i32,
    pub fill: i32,
    pub align: style_align,
    pub list: style_list,
    pub range_type: style_range_type,
    pub range_argument: u_int,
    pub range_string: [i8; 16],
    pub width: i32,
    pub pad: i32,
    pub default_type: style_default_type,
}
pub type style_default_type = u32;
pub const STYLE_DEFAULT_POP: style_default_type = 2;
pub const STYLE_DEFAULT_PUSH: style_default_type = 1;
pub const STYLE_DEFAULT_BASE: style_default_type = 0;
pub type style_range_type = u32;
pub const STYLE_RANGE_USER: style_range_type = 6;
pub const STYLE_RANGE_SESSION: style_range_type = 5;
pub const STYLE_RANGE_WINDOW: style_range_type = 4;
pub const STYLE_RANGE_PANE: style_range_type = 3;
pub const STYLE_RANGE_RIGHT: style_range_type = 2;
pub const STYLE_RANGE_LEFT: style_range_type = 1;
pub const STYLE_RANGE_NONE: style_range_type = 0;
pub type style_list = u32;
pub const STYLE_LIST_RIGHT_MARKER: style_list = 4;
pub const STYLE_LIST_LEFT_MARKER: style_list = 3;
pub const STYLE_LIST_FOCUS: style_list = 2;
pub const STYLE_LIST_ON: style_list = 1;
pub const STYLE_LIST_OFF: style_list = 0;
pub type style_align = u32;
pub const STYLE_ALIGN_ABSOLUTE_CENTRE: style_align = 4;
pub const STYLE_ALIGN_RIGHT: style_align = 3;
pub const STYLE_ALIGN_CENTRE: style_align = 2;
pub const STYLE_ALIGN_LEFT: style_align = 1;
pub const STYLE_ALIGN_DEFAULT: style_align = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_25 {
    pub tqh_first: *mut window_mode_entry,
    pub tqh_last: *mut *mut window_mode_entry,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_mode_entry {
    pub wp: *mut window_pane,
    pub swp: *mut window_pane,
    pub mode: *const window_mode,
    pub data: *mut libc::c_void,
    pub screen: *mut screen,
    pub prefix: u_int,
    pub entry: C2RustUnnamed_26,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_26 {
    pub tqe_next: *mut window_mode_entry,
    pub tqe_prev: *mut *mut window_mode_entry,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_mode {
    pub name: *const i8,
    pub default_format: *const i8,
    pub init: Option<
        unsafe extern "C" fn(*mut window_mode_entry, *mut cmd_find_state, *mut args) -> *mut screen,
    >,
    pub free: Option<unsafe extern "C" fn(*mut window_mode_entry) -> ()>,
    pub resize: Option<unsafe extern "C" fn(*mut window_mode_entry, u_int, u_int) -> ()>,
    pub update: Option<unsafe extern "C" fn(*mut window_mode_entry) -> ()>,
    pub key: Option<
        unsafe extern "C" fn(
            *mut window_mode_entry,
            *mut client,
            *mut session,
            *mut winlink,
            key_code,
            *mut mouse_event,
        ) -> (),
    >,
    pub key_table: Option<unsafe extern "C" fn(*mut window_mode_entry) -> *const i8>,
    pub command: Option<
        unsafe extern "C" fn(
            *mut window_mode_entry,
            *mut client,
            *mut session,
            *mut winlink,
            *mut args,
            *mut mouse_event,
        ) -> (),
    >,
    pub formats: Option<unsafe extern "C" fn(*mut window_mode_entry, *mut format_tree) -> ()>,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_find_state {
    pub flags: i32,
    pub current: *mut cmd_find_state,
    pub s: *mut session,
    pub wl: *mut winlink,
    pub w: *mut window,
    pub wp: *mut window_pane,
    pub idx: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_offset {
    pub used: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct colour_palette {
    pub fg: i32,
    pub bg: i32,
    pub palette: *mut i32,
    pub default_palette: *mut i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_resizes {
    pub tqh_first: *mut window_pane_resize,
    pub tqh_last: *mut *mut window_pane_resize,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_resize {
    pub sx: u_int,
    pub sy: u_int,
    pub osx: u_int,
    pub osy: u_int,
    pub entry: C2RustUnnamed_27,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_27 {
    pub tqe_next: *mut window_pane_resize,
    pub tqe_prev: *mut *mut window_pane_resize,
}
pub type layout_type = u32;
pub const LAYOUT_WINDOWPANE: layout_type = 2;
pub const LAYOUT_TOPBOTTOM: layout_type = 1;
pub const LAYOUT_LEFTRIGHT: layout_type = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_panes {
    pub tqh_first: *mut window_pane,
    pub tqh_last: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlink_stack {
    pub tqh_first: *mut winlink,
    pub tqh_last: *mut *mut winlink,
}
pub type prompt_type = u32;
pub const PROMPT_TYPE_INVALID: prompt_type = 255;
pub const PROMPT_TYPE_WINDOW_TARGET: prompt_type = 3;
pub const PROMPT_TYPE_TARGET: prompt_type = 2;
pub const PROMPT_TYPE_SEARCH: prompt_type = 1;
pub const PROMPT_TYPE_COMMAND: prompt_type = 0;
pub type C2RustUnnamed_28 = u32;
pub const PROMPT_COMMAND: C2RustUnnamed_28 = 1;
pub const PROMPT_ENTRY: C2RustUnnamed_28 = 0;
pub type prompt_free_cb = Option<unsafe extern "C" fn(*mut libc::c_void) -> ()>;
pub type prompt_input_cb =
    Option<unsafe extern "C" fn(*mut client, *mut libc::c_void, *const i8, i32) -> i32>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_table {
    pub name: *const i8,
    pub activity_time: timeval,
    pub key_bindings: key_bindings,
    pub default_key_bindings: key_bindings,
    pub references: u_int,
    pub entry: C2RustUnnamed_29,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_29 {
    pub rbe_left: *mut key_table,
    pub rbe_right: *mut key_table,
    pub rbe_parent: *mut key_table,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_bindings {
    pub rbh_root: *mut key_binding,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_binding {
    pub key: key_code,
    pub cmdlist: *mut cmd_list,
    pub note: *const i8,
    pub flags: i32,
    pub entry: C2RustUnnamed_30,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_30 {
    pub rbe_left: *mut key_binding,
    pub rbe_right: *mut key_binding,
    pub rbe_parent: *mut key_binding,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_list {
    pub references: i32,
    pub group: u_int,
    pub list: *mut cmds,
}
pub type C2RustUnnamed_31 = u32;
pub const CLIENT_EXIT_DETACH: C2RustUnnamed_31 = 2;
pub const CLIENT_EXIT_SHUTDOWN: C2RustUnnamed_31 = 1;
pub const CLIENT_EXIT_RETURN: C2RustUnnamed_31 = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct status_line {
    pub timer: event,
    pub screen: screen,
    pub active: *mut screen,
    pub references: i32,
    pub style: grid_cell,
    pub entries: [status_line_entry; 5],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct status_line_entry {
    pub expanded: *mut i8,
    pub ranges: style_ranges,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style_ranges {
    pub tqh_first: *mut style_range,
    pub tqh_last: *mut *mut style_range,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style_range {
    pub type_0: style_range_type,
    pub argument: u_int,
    pub string: [i8; 16],
    pub start: u_int,
    pub end: u_int,
    pub entry: C2RustUnnamed_32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_32 {
    pub tqe_next: *mut style_range,
    pub tqe_prev: *mut *mut style_range,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct tty {
    pub client: *mut client,
    pub start_timer: event,
    pub clipboard_timer: event,
    pub last_requests: time_t,
    pub sx: u_int,
    pub sy: u_int,
    pub xpixel: u_int,
    pub ypixel: u_int,
    pub cx: u_int,
    pub cy: u_int,
    pub cstyle: screen_cursor_style,
    pub ccolour: i32,
    pub oflag: i32,
    pub oox: u_int,
    pub ooy: u_int,
    pub osx: u_int,
    pub osy: u_int,
    pub mode: i32,
    pub fg: i32,
    pub bg: i32,
    pub rlower: u_int,
    pub rupper: u_int,
    pub rleft: u_int,
    pub rright: u_int,
    pub event_in: event,
    pub in_0: *mut evbuffer,
    pub event_out: event,
    pub out: *mut evbuffer,
    pub timer: event,
    pub discarded: size_t,
    pub tio: termios,
    pub cell: grid_cell,
    pub last_cell: grid_cell,
    pub flags: i32,
    pub term: *mut tty_term,
    pub mouse_last_x: u_int,
    pub mouse_last_y: u_int,
    pub mouse_last_b: u_int,
    pub mouse_drag_flag: i32,
    pub mouse_scrolling_flag: i32,
    pub mouse_slider_mpos: i32,
    pub mouse_drag_update: Option<unsafe extern "C" fn(*mut client, *mut mouse_event) -> ()>,
    pub mouse_drag_release: Option<unsafe extern "C" fn(*mut client, *mut mouse_event) -> ()>,
    pub key_timer: event,
    pub key_tree: *mut tty_key,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct tty_term {
    pub name: *mut i8,
    pub tty: *mut tty,
    pub features: i32,
    pub acs: [[i8; 2]; 256],
    pub codes: *mut tty_code,
    pub flags: i32,
    pub entry: C2RustUnnamed_33,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_33 {
    pub le_next: *mut tty_term,
    pub le_prev: *mut *mut tty_term,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_windows {
    pub rbh_root: *mut client_window,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_window {
    pub window: u_int,
    pub pane: *mut window_pane,
    pub sx: u_int,
    pub sy: u_int,
    pub entry: C2RustUnnamed_34,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_34 {
    pub rbe_left: *mut client_window,
    pub rbe_right: *mut client_window,
    pub rbe_parent: *mut client_window,
    pub rbe_color: i32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct environ_entry {
    pub name: *mut i8,
    pub value: *mut i8,
    pub flags: i32,
    pub entry: C2RustUnnamed_35,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_35 {
    pub rbe_left: *mut environ_entry,
    pub rbe_right: *mut environ_entry,
    pub rbe_parent: *mut environ_entry,
    pub rbe_color: i32,
}
pub type args_type = u32;
pub const ARGS_COMMANDS: args_type = 2;
pub const ARGS_STRING: args_type = 1;
pub const ARGS_NONE: args_type = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct args_value {
    pub type_0: args_type,
    pub c2rust_unnamed: C2RustUnnamed_37,
    pub cached: *mut i8,
    pub entry: C2RustUnnamed_36,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_36 {
    pub tqe_next: *mut args_value,
    pub tqe_prev: *mut *mut args_value,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_37 {
    pub string: *mut i8,
    pub cmdlist: *mut cmd_list,
}
pub type cmd_parse_status = u32;
pub const CMD_PARSE_SUCCESS: cmd_parse_status = 1;
pub const CMD_PARSE_ERROR: cmd_parse_status = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_result {
    pub status: cmd_parse_status,
    pub cmdlist: *mut cmd_list,
    pub error: *mut i8,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_input {
    pub flags: i32,
    pub file: *const i8,
    pub line: u_int,
    pub item: *mut cmdq_item,
    pub c: *mut client,
    pub fs: cmd_find_state,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_commands {
    pub tqh_first: *mut cmd_parse_command,
    pub tqh_last: *mut *mut cmd_parse_command,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_command {
    pub line: u_int,
    pub arguments: cmd_parse_arguments,
    pub entry: C2RustUnnamed_38,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_38 {
    pub tqe_next: *mut cmd_parse_command,
    pub tqe_prev: *mut *mut cmd_parse_command,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_arguments {
    pub tqh_first: *mut cmd_parse_argument,
    pub tqh_last: *mut *mut cmd_parse_argument,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_argument {
    pub type_0: cmd_parse_argument_type,
    pub string: *mut i8,
    pub commands: *mut cmd_parse_commands,
    pub cmdlist: *mut cmd_list,
    pub entry: C2RustUnnamed_39,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_39 {
    pub tqe_next: *mut cmd_parse_argument,
    pub tqe_prev: *mut *mut cmd_parse_argument,
}
pub type cmd_parse_argument_type = u32;
pub const CMD_PARSE_PARSED_COMMANDS: cmd_parse_argument_type = 2;
pub const CMD_PARSE_COMMANDS: cmd_parse_argument_type = 1;
pub const CMD_PARSE_STRING: cmd_parse_argument_type = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_state {
    pub f: *mut FILE,
    pub buf: *const i8,
    pub len: size_t,
    pub off: size_t,
    pub condition: i32,
    pub eol: i32,
    pub eof: i32,
    pub input: *mut cmd_parse_input,
    pub escapes: u_int,
    pub error: *mut i8,
    pub commands: *mut cmd_parse_commands,
    pub scope: *mut cmd_parse_scope,
    pub stack: C2RustUnnamed_40,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_40 {
    pub tqh_first: *mut cmd_parse_scope,
    pub tqh_last: *mut *mut cmd_parse_scope,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_scope {
    pub flag: i32,
    pub entry: C2RustUnnamed_41,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_41 {
    pub tqe_next: *mut cmd_parse_scope,
    pub tqe_prev: *mut *mut cmd_parse_scope,
}
pub type YYINT = i32;
#[derive(Copy, Clone)]
#[repr(C)]
pub union YYSTYPE {
    pub token: *mut i8,
    pub arguments: *mut cmd_parse_arguments,
    pub argument: *mut cmd_parse_argument,
    pub flag: i32,
    pub elif: C2RustUnnamed_42,
    pub commands: *mut cmd_parse_commands,
    pub command: *mut cmd_parse_command,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_42 {
    pub flag: i32,
    pub commands: *mut cmd_parse_commands,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct YYSTACKDATA {
    pub stacksize: u32,
    pub s_base: *mut YYINT,
    pub s_mark: *mut YYINT,
    pub s_last: *mut YYINT,
    pub l_base: *mut YYSTYPE,
    pub l_mark: *mut YYSTYPE,
}
pub type C2RustUnnamed_43 = u32;
pub const SINGLE_QUOTES: C2RustUnnamed_43 = 3;
pub const DOUBLE_QUOTES: C2RustUnnamed_43 = 2;
pub const NONE: C2RustUnnamed_43 = 1;
pub const START: C2RustUnnamed_43 = 0;
static mut parse_state: cmd_parse_state = cmd_parse_state {
    f: 0 as *const FILE as *mut FILE,
    buf: 0 as *const i8,
    len: 0,
    off: 0,
    condition: 0,
    eol: 0,
    eof: 0,
    input: 0 as *const cmd_parse_input as *mut cmd_parse_input,
    escapes: 0,
    error: 0 as *const i8 as *mut i8,
    commands: 0 as *const cmd_parse_commands as *mut cmd_parse_commands,
    scope: 0 as *const cmd_parse_scope as *mut cmd_parse_scope,
    stack: C2RustUnnamed_40 {
        tqh_first: 0 as *const cmd_parse_scope as *mut cmd_parse_scope,
        tqh_last: 0 as *const *mut cmd_parse_scope as *mut *mut cmd_parse_scope,
    },
};
static mut yylhs: [YYINT; 47] = [
    -(1 as i32),
    0 as i32,
    0 as i32,
    10 as i32,
    10 as i32,
    11 as i32,
    11 as i32,
    11 as i32,
    11 as i32,
    2 as i32,
    2 as i32,
    1 as i32,
    17 as i32,
    17 as i32,
    18 as i32,
    16 as i32,
    5 as i32,
    19 as i32,
    6 as i32,
    20 as i32,
    13 as i32,
    13 as i32,
    13 as i32,
    13 as i32,
    7 as i32,
    7 as i32,
    12 as i32,
    12 as i32,
    12 as i32,
    12 as i32,
    12 as i32,
    15 as i32,
    15 as i32,
    15 as i32,
    14 as i32,
    14 as i32,
    14 as i32,
    14 as i32,
    8 as i32,
    8 as i32,
    3 as i32,
    3 as i32,
    4 as i32,
    4 as i32,
    4 as i32,
    9 as i32,
    9 as i32,
];
static mut yylen: [YYINT; 47] = [
    2 as i32, 0 as i32, 1 as i32, 2 as i32, 3 as i32, 0 as i32, 1 as i32, 1 as i32, 1 as i32,
    1 as i32, 1 as i32, 1 as i32, 0 as i32, 1 as i32, 1 as i32, 2 as i32, 2 as i32, 1 as i32,
    2 as i32, 1 as i32, 4 as i32, 7 as i32, 5 as i32, 8 as i32, 3 as i32, 4 as i32, 1 as i32,
    2 as i32, 3 as i32, 3 as i32, 1 as i32, 1 as i32, 2 as i32, 3 as i32, 3 as i32, 5 as i32,
    4 as i32, 6 as i32, 2 as i32, 3 as i32, 1 as i32, 2 as i32, 1 as i32, 1 as i32, 2 as i32,
    2 as i32, 3 as i32,
];
static mut yydefred: [YYINT; 74] = [
    0 as i32, 0 as i32, 0 as i32, 14 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    7 as i32, 30 as i32, 26 as i32, 6 as i32, 0 as i32, 0 as i32, 15 as i32, 9 as i32, 10 as i32,
    16 as i32, 11 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 3 as i32, 0 as i32, 0 as i32,
    0 as i32, 17 as i32, 0 as i32, 19 as i32, 0 as i32, 0 as i32, 0 as i32, 34 as i32, 4 as i32,
    28 as i32, 29 as i32, 42 as i32, 43 as i32, 0 as i32, 33 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 20 as i32, 18 as i32, 0 as i32, 0 as i32, 36 as i32, 0 as i32, 44 as i32, 0 as i32,
    0 as i32, 41 as i32, 0 as i32, 0 as i32, 22 as i32, 0 as i32, 39 as i32, 0 as i32, 35 as i32,
    0 as i32, 45 as i32, 0 as i32, 0 as i32, 0 as i32, 37 as i32, 46 as i32, 25 as i32, 0 as i32,
    21 as i32, 23 as i32,
];
static mut yydgoto: [YYINT; 21] = [
    4 as i32, 18 as i32, 19 as i32, 41 as i32, 42 as i32, 5 as i32, 31 as i32, 44 as i32,
    32 as i32, 52 as i32, 6 as i32, 7 as i32, 8 as i32, 9 as i32, 10 as i32, 11 as i32, 12 as i32,
    13 as i32, 14 as i32, 33 as i32, 34 as i32,
];
static mut yysindex: [YYINT; 74] = [
    -(175 as i32),
    -(227 as i32),
    -(172 as i32),
    0 as i32,
    0 as i32,
    -(10 as i32),
    -(175 as i32),
    46 as i32,
    10 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(205 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(175 as i32),
    -(238 as i32),
    -(56 as i32),
    53 as i32,
    0 as i32,
    -(238 as i32),
    -(118 as i32),
    -(228 as i32),
    0 as i32,
    -(172 as i32),
    0 as i32,
    -(238 as i32),
    -(234 as i32),
    -(238 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(175 as i32),
    0 as i32,
    -(118 as i32),
    63 as i32,
    -(234 as i32),
    66 as i32,
    0 as i32,
    0 as i32,
    -(52 as i32),
    -(238 as i32),
    0 as i32,
    -(55 as i32),
    0 as i32,
    -(175 as i32),
    3 as i32,
    0 as i32,
    -(175 as i32),
    68 as i32,
    0 as i32,
    -(175 as i32),
    0 as i32,
    -(55 as i32),
    0 as i32,
    4 as i32,
    0 as i32,
    -(208 as i32),
    -(175 as i32),
    -(219 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    -(219 as i32),
    0 as i32,
    0 as i32,
];
static mut yyrindex: [YYINT; 74] = [
    1 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(184 as i32),
    2 as i32,
    0 as i32,
    5 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(4 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    6 as i32,
    -(184 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    7 as i32,
    12 as i32,
    6 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(184 as i32),
    0 as i32,
    -(184 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(2 as i32),
    0 as i32,
    15 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(215 as i32),
    -(184 as i32),
    0 as i32,
    0 as i32,
    0 as i32,
    -(2 as i32),
    0 as i32,
    0 as i32,
    6 as i32,
    0 as i32,
    0 as i32,
    6 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(1 as i32),
    6 as i32,
    6 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    6 as i32,
    0 as i32,
    0 as i32,
];
static mut yygindex: [YYINT; 21] = [
    0 as i32,
    57 as i32,
    0 as i32,
    40 as i32,
    0 as i32,
    39 as i32,
    -(17 as i32),
    28 as i32,
    47 as i32,
    0 as i32,
    9 as i32,
    14 as i32,
    56 as i32,
    0 as i32,
    69 as i32,
    71 as i32,
    0 as i32,
    0 as i32,
    0 as i32,
    -(8 as i32),
    -(9 as i32),
];
static mut yytable: [YYINT; 278] = [
    20 as i32, 1 as i32, 2 as i32, 25 as i32, 25 as i32, 40 as i32, 31 as i32, 25 as i32, 5 as i32,
    5 as i32, 43 as i32, 5 as i32, 5 as i32, 24 as i32, 35 as i32, 8 as i32, 5 as i32, 27 as i32,
    46 as i32, 45 as i32, 23 as i32, 2 as i32, 32 as i32, 50 as i32, 49 as i32, 40 as i32,
    28 as i32, 3 as i32, 30 as i32, 27 as i32, 1 as i32, 2 as i32, 28 as i32, 29 as i32, 30 as i32,
    58 as i32, 57 as i32, 3 as i32, 15 as i32, 1 as i32, 2 as i32, 23 as i32, 62 as i32, 30 as i32,
    21 as i32, 38 as i32, 3 as i32, 38 as i32, 43 as i32, 53 as i32, 1 as i32, 2 as i32, 68 as i32,
    29 as i32, 54 as i32, 31 as i32, 24 as i32, 3 as i32, 72 as i32, 26 as i32, 21 as i32,
    22 as i32, 73 as i32, 35 as i32, 21 as i32, 65 as i32, 27 as i32, 63 as i32, 67 as i32,
    25 as i32, 21 as i32, 32 as i32, 21 as i32, 56 as i32, 40 as i32, 71 as i32, 59 as i32,
    22 as i32, 66 as i32, 23 as i32, 12 as i32, 23 as i32, 55 as i32, 1 as i32, 2 as i32,
    23 as i32, 47 as i32, 48 as i32, 21 as i32, 51 as i32, 3 as i32, 16 as i32, 17 as i32,
    70 as i32, 36 as i32, 60 as i32, 37 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 61 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 31 as i32, 0 as i32, 5 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 64 as i32,
    69 as i32, 8 as i32, 0 as i32, 27 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 32 as i32,
    0 as i32, 0 as i32, 40 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 38 as i32,
    39 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 28 as i32, 29 as i32, 30 as i32, 30 as i32, 0 as i32, 29 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    0 as i32, 0 as i32, 0 as i32, 2 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32, 0 as i32,
    3 as i32, 31 as i32, 31 as i32, 31 as i32, 24 as i32, 13 as i32, 24 as i32, 12 as i32,
    12 as i32, 0 as i32, 12 as i32, 12 as i32, 27 as i32, 27 as i32, 27 as i32, 12 as i32,
    12 as i32, 32 as i32, 32 as i32, 32 as i32, 40 as i32, 40 as i32, 40 as i32,
];
static mut yycheck: [YYINT; 278] = [
    10 as i32,
    0 as i32,
    0 as i32,
    59 as i32,
    59 as i32,
    123 as i32,
    10 as i32,
    59 as i32,
    10 as i32,
    10 as i32,
    27 as i32,
    10 as i32,
    10 as i32,
    10 as i32,
    10 as i32,
    10 as i32,
    10 as i32,
    10 as i32,
    27 as i32,
    27 as i32,
    6 as i32,
    259 as i32,
    10 as i32,
    32 as i32,
    32 as i32,
    10 as i32,
    260 as i32,
    265 as i32,
    262 as i32,
    20 as i32,
    258 as i32,
    259 as i32,
    260 as i32,
    261 as i32,
    262 as i32,
    44 as i32,
    44 as i32,
    265 as i32,
    265 as i32,
    258 as i32,
    259 as i32,
    27 as i32,
    51 as i32,
    262 as i32,
    5 as i32,
    260 as i32,
    265 as i32,
    262 as i32,
    65 as i32,
    40 as i32,
    258 as i32,
    259 as i32,
    61 as i32,
    261 as i32,
    40 as i32,
    59 as i32,
    10 as i32,
    265 as i32,
    67 as i32,
    264 as i32,
    21 as i32,
    5 as i32,
    71 as i32,
    10 as i32,
    25 as i32,
    56 as i32,
    59 as i32,
    53 as i32,
    59 as i32,
    59 as i32,
    31 as i32,
    59 as i32,
    33 as i32,
    10 as i32,
    59 as i32,
    66 as i32,
    10 as i32,
    21 as i32,
    10 as i32,
    65 as i32,
    264 as i32,
    67 as i32,
    42 as i32,
    258 as i32,
    259 as i32,
    71 as i32,
    29 as i32,
    31 as i32,
    49 as i32,
    33 as i32,
    265 as i32,
    263 as i32,
    264 as i32,
    65 as i32,
    25 as i32,
    48 as i32,
    25 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    49 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    125 as i32,
    -(1 as i32),
    125 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    125 as i32,
    125 as i32,
    125 as i32,
    -(1 as i32),
    125 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    125 as i32,
    -(1 as i32),
    -(1 as i32),
    125 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    264 as i32,
    265 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    260 as i32,
    261 as i32,
    262 as i32,
    262 as i32,
    -(1 as i32),
    261 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    259 as i32,
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    -(1 as i32),
    265 as i32,
    260 as i32,
    261 as i32,
    262 as i32,
    260 as i32,
    264 as i32,
    262 as i32,
    264 as i32,
    264 as i32,
    -(1 as i32),
    264 as i32,
    264 as i32,
    260 as i32,
    261 as i32,
    262 as i32,
    264 as i32,
    264 as i32,
    260 as i32,
    261 as i32,
    262 as i32,
    260 as i32,
    261 as i32,
    262 as i32,
];
#[no_mangle]
pub static mut yyerrflag: i32 = 0;
#[no_mangle]
pub static mut yychar: i32 = 0;
#[no_mangle]
pub static mut yyval: YYSTYPE = YYSTYPE {
    token: 0 as *const i8 as *mut i8,
};
#[no_mangle]
pub static mut yylval: YYSTYPE = YYSTYPE {
    token: 0 as *const i8 as *mut i8,
};
#[no_mangle]
pub static mut yynerrs: i32 = 0;
static mut yystack: YYSTACKDATA = YYSTACKDATA {
    stacksize: 0,
    s_base: 0 as *const YYINT as *mut YYINT,
    s_mark: 0 as *const YYINT as *mut YYINT,
    s_last: 0 as *const YYINT as *mut YYINT,
    l_base: 0 as *const YYSTYPE as *mut YYSTYPE,
    l_mark: 0 as *const YYSTYPE as *mut YYSTYPE,
};
extern "C" fn cmd_parse_get_error(
    mut file: *const i8,
    mut line: u_int,
    mut error: *const i8,
) -> *mut i8 {
    let mut s: *mut i8 = std::ptr::null_mut::<i8>();
    if file.is_null() {
        s = unsafe { xstrdup(error) };
    } else {
        (unsafe {
            xasprintf(
                &mut s as *mut *mut i8,
                b"%s:%u: %s\0" as *const u8 as *const i8,
                file,
                line,
                error,
            )
        });
    }
    return s;
}
extern "C" fn cmd_parse_print_commands(mut pi: *mut cmd_parse_input, mut cmdlist: *mut cmd_list) {
    let mut s: *mut i8 = std::ptr::null_mut::<i8>();
    if (unsafe { (*pi).item }).is_null() || !(unsafe { (*pi).flags }) & 0x8 as i32 != 0 {
        return;
    }
    s = unsafe { cmd_list_print(cmdlist, 0 as i32) };
    if !(unsafe { (*pi).file }).is_null() {
        (unsafe {
            cmdq_print(
                (*pi).item,
                b"%s:%u: %s\0" as *const u8 as *const i8,
                (*pi).file,
                (*pi).line,
                s,
            )
        });
    } else {
        (unsafe {
            cmdq_print(
                (*pi).item,
                b"%u: %s\0" as *const u8 as *const i8,
                (*pi).line,
                s,
            )
        });
    }
    (unsafe { free(s as *mut libc::c_void) });
}
extern "C" fn cmd_parse_free_argument(mut arg: *mut cmd_parse_argument) {
    match (unsafe { (*arg).type_0 }) as u32 {
        0 => {
            (unsafe { free((*arg).string as *mut libc::c_void) });
        }
        1 => {
            cmd_parse_free_commands(unsafe { (*arg).commands });
        }
        2 => {
            (unsafe { cmd_list_free((*arg).cmdlist) });
        }
        _ => {}
    }
    (unsafe { free(arg as *mut libc::c_void) });
}
extern "C" fn cmd_parse_free_arguments(mut args: *mut cmd_parse_arguments) {
    let mut arg: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut arg1: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    arg = unsafe { (*args).tqh_first };
    while !arg.is_null() && {
        arg1 = unsafe { (*arg).entry.tqe_next };
        1 as i32 != 0
    } {
        if !(unsafe { (*arg).entry.tqe_next }).is_null() {
            (unsafe { (*(*arg).entry.tqe_next).entry.tqe_prev = (*arg).entry.tqe_prev });
        } else {
            (unsafe { (*args).tqh_last = (*arg).entry.tqe_prev });
        }
        (unsafe { *(*arg).entry.tqe_prev = (*arg).entry.tqe_next });
        cmd_parse_free_argument(arg);
        arg = arg1;
    }
}
extern "C" fn cmd_parse_free_command(mut cmd: *mut cmd_parse_command) {
    cmd_parse_free_arguments(unsafe { &mut (*cmd).arguments });
    (unsafe { free(cmd as *mut libc::c_void) });
}
extern "C" fn cmd_parse_new_commands() -> *mut cmd_parse_commands {
    let mut cmds: *mut cmd_parse_commands = std::ptr::null_mut::<cmd_parse_commands>();
    cmds = (unsafe { xmalloc(::core::mem::size_of::<cmd_parse_commands>() as u64) })
        as *mut cmd_parse_commands;
    (unsafe { (*cmds).tqh_first = std::ptr::null_mut::<cmd_parse_command>() });
    (unsafe { (*cmds).tqh_last = &mut (*cmds).tqh_first });
    return cmds;
}
extern "C" fn cmd_parse_free_commands(mut cmds: *mut cmd_parse_commands) {
    let mut cmd: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    let mut cmd1: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    cmd = unsafe { (*cmds).tqh_first };
    while !cmd.is_null() && {
        cmd1 = unsafe { (*cmd).entry.tqe_next };
        1 as i32 != 0
    } {
        if !(unsafe { (*cmd).entry.tqe_next }).is_null() {
            (unsafe { (*(*cmd).entry.tqe_next).entry.tqe_prev = (*cmd).entry.tqe_prev });
        } else {
            (unsafe { (*cmds).tqh_last = (*cmd).entry.tqe_prev });
        }
        (unsafe { *(*cmd).entry.tqe_prev = (*cmd).entry.tqe_next });
        cmd_parse_free_command(cmd);
        cmd = cmd1;
    }
    (unsafe { free(cmds as *mut libc::c_void) });
}
extern "C" fn cmd_parse_run_parser(mut cause: *mut *mut i8) -> *mut cmd_parse_commands {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    let mut scope: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
    let mut scope1: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
    let mut retval: i32 = 0;
    (unsafe { (*ps).commands = std::ptr::null_mut::<cmd_parse_commands>() });
    (unsafe { (*ps).stack.tqh_first = std::ptr::null_mut::<cmd_parse_scope>() });
    (unsafe { (*ps).stack.tqh_last = &mut (*ps).stack.tqh_first });
    retval = yyparse();
    scope = unsafe { (*ps).stack.tqh_first };
    while !scope.is_null() && {
        scope1 = unsafe { (*scope).entry.tqe_next };
        1 as i32 != 0
    } {
        if !(unsafe { (*scope).entry.tqe_next }).is_null() {
            (unsafe { (*(*scope).entry.tqe_next).entry.tqe_prev = (*scope).entry.tqe_prev });
        } else {
            (unsafe { (*ps).stack.tqh_last = (*scope).entry.tqe_prev });
        }
        (unsafe { *(*scope).entry.tqe_prev = (*scope).entry.tqe_next });
        (unsafe { free(scope as *mut libc::c_void) });
        scope = scope1;
    }
    if retval != 0 as i32 {
        (unsafe { *cause = (*ps).error });
        return std::ptr::null_mut::<cmd_parse_commands>();
    }
    if (unsafe { (*ps).commands }).is_null() {
        return cmd_parse_new_commands();
    }
    return unsafe { (*ps).commands };
}
extern "C" fn cmd_parse_do_file(
    mut f: *mut FILE,
    mut pi: *mut cmd_parse_input,
    mut cause: *mut *mut i8,
) -> *mut cmd_parse_commands {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    (unsafe {
        memset(
            ps as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_state>() as u64,
        )
    });
    (unsafe { (*ps).input = pi });
    (unsafe { (*ps).f = f });
    return cmd_parse_run_parser(cause);
}
extern "C" fn cmd_parse_do_buffer(
    mut buf: *const i8,
    mut len: size_t,
    mut pi: *mut cmd_parse_input,
    mut cause: *mut *mut i8,
) -> *mut cmd_parse_commands {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    (unsafe {
        memset(
            ps as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_state>() as u64,
        )
    });
    (unsafe { (*ps).input = pi });
    (unsafe { (*ps).buf = buf });
    (unsafe { (*ps).len = len });
    return cmd_parse_run_parser(cause);
}
extern "C" fn cmd_parse_log_commands(mut cmds: *mut cmd_parse_commands, mut prefix: *const i8) {
    let mut cmd: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    let mut arg: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut i: u_int = 0;
    let mut j: u_int = 0;
    let mut s: *mut i8 = std::ptr::null_mut::<i8>();
    i = 0 as i32 as u_int;
    cmd = unsafe { (*cmds).tqh_first };
    while !cmd.is_null() {
        j = 0 as i32 as u_int;
        arg = unsafe { (*cmd).arguments.tqh_first };
        while !arg.is_null() {
            match (unsafe { (*arg).type_0 }) as u32 {
                0 => {
                    (unsafe {
                        log_debug(
                            b"%s %u:%u: %s\0" as *const u8 as *const i8,
                            prefix,
                            i,
                            j,
                            (*arg).string,
                        )
                    });
                }
                1 => {
                    (unsafe {
                        xasprintf(
                            &mut s as *mut *mut i8,
                            b"%s %u:%u\0" as *const u8 as *const i8,
                            prefix,
                            i,
                            j,
                        )
                    });
                    cmd_parse_log_commands(unsafe { (*arg).commands }, s);
                    (unsafe { free(s as *mut libc::c_void) });
                }
                2 => {
                    s = unsafe { cmd_list_print((*arg).cmdlist, 0 as i32) };
                    (unsafe {
                        log_debug(b"%s %u:%u: %s\0" as *const u8 as *const i8, prefix, i, j, s)
                    });
                    (unsafe { free(s as *mut libc::c_void) });
                }
                _ => {}
            }
            j = j.wrapping_add(1);
            arg = unsafe { (*arg).entry.tqe_next };
        }
        i = i.wrapping_add(1);
        cmd = unsafe { (*cmd).entry.tqe_next };
    }
}
extern "C" fn cmd_parse_expand_alias(
    mut cmd: *mut cmd_parse_command,
    mut pi: *mut cmd_parse_input,
    mut pr: *mut cmd_parse_result,
) -> i32 {
    let mut arg: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut arg1: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut first: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut cmds: *mut cmd_parse_commands = std::ptr::null_mut::<cmd_parse_commands>();
    let mut last: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    let mut alias: *mut i8 = std::ptr::null_mut::<i8>();
    let mut name: *mut i8 = std::ptr::null_mut::<i8>();
    let mut cause: *mut i8 = std::ptr::null_mut::<i8>();
    if (unsafe { (*pi).flags }) & 0x4 as i32 != 0 {
        return 0 as i32;
    }
    (unsafe {
        memset(
            pr as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    first = unsafe { (*cmd).arguments.tqh_first };
    if first.is_null() || (unsafe { (*first).type_0 }) as u32 != CMD_PARSE_STRING as i32 as u32 {
        (unsafe { (*pr).status = CMD_PARSE_SUCCESS });
        (unsafe { (*pr).cmdlist = cmd_list_new() });
        return 1 as i32;
    }
    name = unsafe { (*first).string };
    alias = unsafe { cmd_get_alias(name) };
    if alias.is_null() {
        return 0 as i32;
    }
    (unsafe {
        log_debug(
            b"%s: %u alias %s = %s\0" as *const u8 as *const i8,
            (*::core::mem::transmute::<&[u8; 23], &[i8; 23]>(b"cmd_parse_expand_alias\0")).as_ptr(),
            (*pi).line,
            name,
            alias,
        )
    });
    cmds = cmd_parse_do_buffer(alias, unsafe { strlen(alias) }, pi, &mut cause);
    (unsafe { free(alias as *mut libc::c_void) });
    if cmds.is_null() {
        (unsafe { (*pr).status = CMD_PARSE_ERROR });
        (unsafe { (*pr).error = cause });
        return 1 as i32;
    }
    last = unsafe { *(*((*cmds).tqh_last as *mut cmd_parse_commands)).tqh_last };
    if last.is_null() {
        (unsafe { (*pr).status = CMD_PARSE_SUCCESS });
        (unsafe { (*pr).cmdlist = cmd_list_new() });
        return 1 as i32;
    }
    if !(unsafe { (*first).entry.tqe_next }).is_null() {
        (unsafe { (*(*first).entry.tqe_next).entry.tqe_prev = (*first).entry.tqe_prev });
    } else {
        (unsafe { (*cmd).arguments.tqh_last = (*first).entry.tqe_prev });
    }
    (unsafe { *(*first).entry.tqe_prev = (*first).entry.tqe_next });
    cmd_parse_free_argument(first);
    arg = unsafe { (*cmd).arguments.tqh_first };
    while !arg.is_null() && {
        arg1 = unsafe { (*arg).entry.tqe_next };
        1 as i32 != 0
    } {
        if !(unsafe { (*arg).entry.tqe_next }).is_null() {
            (unsafe { (*(*arg).entry.tqe_next).entry.tqe_prev = (*arg).entry.tqe_prev });
        } else {
            (unsafe { (*cmd).arguments.tqh_last = (*arg).entry.tqe_prev });
        }
        (unsafe { *(*arg).entry.tqe_prev = (*arg).entry.tqe_next });
        (unsafe { (*arg).entry.tqe_next = std::ptr::null_mut::<cmd_parse_argument>() });
        (unsafe { (*arg).entry.tqe_prev = (*last).arguments.tqh_last });
        (unsafe { *(*last).arguments.tqh_last = arg });
        (unsafe { (*last).arguments.tqh_last = &mut (*arg).entry.tqe_next });
        arg = arg1;
    }
    cmd_parse_log_commands(
        cmds,
        (*(unsafe { ::core::mem::transmute::<&[u8; 23], &[i8; 23]>(b"cmd_parse_expand_alias\0") }))
            .as_ptr(),
    );
    (unsafe { (*pi).flags |= 0x4 as i32 });
    cmd_parse_build_commands(cmds, pi, pr);
    (unsafe { (*pi).flags &= !(0x4 as i32) });
    return 1 as i32;
}
extern "C" fn cmd_parse_build_command(
    mut cmd: *mut cmd_parse_command,
    mut pi: *mut cmd_parse_input,
    mut pr: *mut cmd_parse_result,
) {
    let mut current_block: u64;
    let mut arg: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut add: *mut cmd = std::ptr::null_mut::<cmd>();
    let mut cause: *mut i8 = std::ptr::null_mut::<i8>();
    let mut values: *mut args_value = std::ptr::null_mut::<args_value>();
    let mut count: u_int = 0 as i32 as u_int;
    let mut idx: u_int = 0;
    (unsafe {
        memset(
            pr as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    if cmd_parse_expand_alias(cmd, pi, pr) != 0 {
        return;
    }
    arg = unsafe { (*cmd).arguments.tqh_first };
    loop {
        if arg.is_null() {
            current_block = 5143058163439228106;
            break;
        }
        values = (unsafe {
            xrecallocarray(
                values as *mut libc::c_void,
                count as size_t,
                count.wrapping_add(1 as i32 as u32) as size_t,
                ::core::mem::size_of::<args_value>() as u64,
            )
        }) as *mut args_value;
        match (unsafe { (*arg).type_0 }) as u32 {
            0 => {
                (unsafe { (*values.offset(count as isize)).type_0 = ARGS_STRING });
                let fresh0 = unsafe { &mut (*values.offset(count as isize)).c2rust_unnamed.string };
                *fresh0 = unsafe { xstrdup((*arg).string) };
            }
            1 => {
                cmd_parse_build_commands(unsafe { (*arg).commands }, pi, pr);
                if (unsafe { (*pr).status }) as u32 != CMD_PARSE_SUCCESS as i32 as u32 {
                    current_block = 3443149493324276528;
                    break;
                }
                (unsafe { (*values.offset(count as isize)).type_0 = ARGS_COMMANDS });
                let fresh1 =
                    unsafe { &mut (*values.offset(count as isize)).c2rust_unnamed.cmdlist };
                *fresh1 = unsafe { (*pr).cmdlist };
            }
            2 => {
                (unsafe { (*values.offset(count as isize)).type_0 = ARGS_COMMANDS });
                let fresh2 =
                    unsafe { &mut (*values.offset(count as isize)).c2rust_unnamed.cmdlist };
                *fresh2 = unsafe { (*arg).cmdlist };
                let fresh3 = unsafe {
                    &mut (*(*values.offset(count as isize)).c2rust_unnamed.cmdlist).references
                };
                *fresh3 += 1;
            }
            _ => {}
        }
        count = count.wrapping_add(1);
        arg = unsafe { (*arg).entry.tqe_next };
    }
    match current_block {
        5143058163439228106 => {
            add = unsafe { cmd_parse(values, count, (*pi).file, (*pi).line, &mut cause) };
            if add.is_null() {
                (unsafe { (*pr).status = CMD_PARSE_ERROR });
                (unsafe { (*pr).error = cmd_parse_get_error((*pi).file, (*pi).line, cause) });
                (unsafe { free(cause as *mut libc::c_void) });
            } else {
                (unsafe { (*pr).status = CMD_PARSE_SUCCESS });
                (unsafe { (*pr).cmdlist = cmd_list_new() });
                (unsafe { cmd_list_append((*pr).cmdlist, add) });
            }
        }
        _ => {}
    }
    idx = 0 as i32 as u_int;
    while idx < count {
        (unsafe { args_free_value(&mut *values.offset(idx as isize)) });
        idx = idx.wrapping_add(1);
    }
    (unsafe { free(values as *mut libc::c_void) });
}
extern "C" fn cmd_parse_build_commands(
    mut cmds: *mut cmd_parse_commands,
    mut pi: *mut cmd_parse_input,
    mut pr: *mut cmd_parse_result,
) {
    let mut cmd: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    let mut line: u_int = (2147483647 as i32 as u32)
        .wrapping_mul(2 as u32)
        .wrapping_add(1 as u32);
    let mut current: *mut cmd_list = std::ptr::null_mut::<cmd_list>();
    let mut result: *mut cmd_list = std::ptr::null_mut::<cmd_list>();
    let mut s: *mut i8 = std::ptr::null_mut::<i8>();
    (unsafe {
        memset(
            pr as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    if (unsafe { (*cmds).tqh_first }).is_null() {
        (unsafe { (*pr).status = CMD_PARSE_SUCCESS });
        (unsafe { (*pr).cmdlist = cmd_list_new() });
        return;
    }
    cmd_parse_log_commands(
        cmds,
        (*(unsafe {
            ::core::mem::transmute::<&[u8; 25], &[i8; 25]>(b"cmd_parse_build_commands\0")
        }))
        .as_ptr(),
    );
    result = unsafe { cmd_list_new() };
    cmd = unsafe { (*cmds).tqh_first };
    while !cmd.is_null() {
        if !(unsafe { (*pi).flags }) & 0x10 as i32 != 0 && (unsafe { (*cmd).line }) != line {
            if !current.is_null() {
                cmd_parse_print_commands(pi, current);
                (unsafe { cmd_list_move(result, current) });
                (unsafe { cmd_list_free(current) });
            }
            current = unsafe { cmd_list_new() };
        }
        if current.is_null() {
            current = unsafe { cmd_list_new() };
        }
        (unsafe { (*pi).line = (*cmd).line });
        line = unsafe { (*pi).line };
        cmd_parse_build_command(cmd, pi, pr);
        if (unsafe { (*pr).status }) as u32 != CMD_PARSE_SUCCESS as i32 as u32 {
            (unsafe { cmd_list_free(result) });
            (unsafe { cmd_list_free(current) });
            return;
        }
        (unsafe { cmd_list_append_all(current, (*pr).cmdlist) });
        (unsafe { cmd_list_free((*pr).cmdlist) });
        cmd = unsafe { (*cmd).entry.tqe_next };
    }
    if !current.is_null() {
        cmd_parse_print_commands(pi, current);
        (unsafe { cmd_list_move(result, current) });
        (unsafe { cmd_list_free(current) });
    }
    s = unsafe { cmd_list_print(result, 0 as i32) };
    (unsafe {
        log_debug(
            b"%s: %s\0" as *const u8 as *const i8,
            (*::core::mem::transmute::<&[u8; 25], &[i8; 25]>(b"cmd_parse_build_commands\0"))
                .as_ptr(),
            s,
        )
    });
    (unsafe { free(s as *mut libc::c_void) });
    (unsafe { (*pr).status = CMD_PARSE_SUCCESS });
    (unsafe { (*pr).cmdlist = result });
}
#[no_mangle]
pub extern "C" fn cmd_parse_from_file(
    mut f: *mut FILE,
    mut pi: *mut cmd_parse_input,
) -> *mut cmd_parse_result {
    static mut pr: cmd_parse_result = cmd_parse_result {
        status: CMD_PARSE_ERROR,
        cmdlist: 0 as *const cmd_list as *mut cmd_list,
        error: 0 as *const i8 as *mut i8,
    };
    let mut input: cmd_parse_input = cmd_parse_input {
        flags: 0,
        file: std::ptr::null::<i8>(),
        line: 0,
        item: std::ptr::null_mut::<cmdq_item>(),
        c: std::ptr::null_mut::<client>(),
        fs: cmd_find_state {
            flags: 0,
            current: std::ptr::null_mut::<cmd_find_state>(),
            s: std::ptr::null_mut::<session>(),
            wl: std::ptr::null_mut::<winlink>(),
            w: std::ptr::null_mut::<window>(),
            wp: std::ptr::null_mut::<window_pane>(),
            idx: 0,
        },
    };
    let mut cmds: *mut cmd_parse_commands = std::ptr::null_mut::<cmd_parse_commands>();
    let mut cause: *mut i8 = std::ptr::null_mut::<i8>();
    if pi.is_null() {
        (unsafe {
            memset(
                &mut input as *mut cmd_parse_input as *mut libc::c_void,
                0 as i32,
                ::core::mem::size_of::<cmd_parse_input>() as u64,
            )
        });
        pi = &mut input;
    }
    (unsafe {
        memset(
            &mut pr as *mut cmd_parse_result as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    cmds = cmd_parse_do_file(f, pi, &mut cause);
    if cmds.is_null() {
        (unsafe { pr.status = CMD_PARSE_ERROR });
        (unsafe { pr.error = cause });
        return unsafe { &mut pr };
    }
    cmd_parse_build_commands(cmds, pi, unsafe { &mut pr });
    cmd_parse_free_commands(cmds);
    return unsafe { &mut pr };
}
#[no_mangle]
pub extern "C" fn cmd_parse_from_string(
    mut s: *const i8,
    mut pi: *mut cmd_parse_input,
) -> *mut cmd_parse_result {
    let mut input: cmd_parse_input = cmd_parse_input {
        flags: 0,
        file: std::ptr::null::<i8>(),
        line: 0,
        item: std::ptr::null_mut::<cmdq_item>(),
        c: std::ptr::null_mut::<client>(),
        fs: cmd_find_state {
            flags: 0,
            current: std::ptr::null_mut::<cmd_find_state>(),
            s: std::ptr::null_mut::<session>(),
            wl: std::ptr::null_mut::<winlink>(),
            w: std::ptr::null_mut::<window>(),
            wp: std::ptr::null_mut::<window_pane>(),
            idx: 0,
        },
    };
    if pi.is_null() {
        (unsafe {
            memset(
                &mut input as *mut cmd_parse_input as *mut libc::c_void,
                0 as i32,
                ::core::mem::size_of::<cmd_parse_input>() as u64,
            )
        });
        pi = &mut input;
    }
    (unsafe { (*pi).flags |= 0x10 as i32 });
    return cmd_parse_from_buffer(s as *const libc::c_void, unsafe { strlen(s) }, pi);
}
#[no_mangle]
pub extern "C" fn cmd_parse_and_insert(
    mut s: *const i8,
    mut pi: *mut cmd_parse_input,
    mut after: *mut cmdq_item,
    mut state: *mut cmdq_state,
    mut error: *mut *mut i8,
) -> cmd_parse_status {
    let mut pr: *mut cmd_parse_result = std::ptr::null_mut::<cmd_parse_result>();
    let mut item: *mut cmdq_item = std::ptr::null_mut::<cmdq_item>();
    pr = cmd_parse_from_string(s, pi);
    match (unsafe { (*pr).status }) as u32 {
        0 => {
            if !error.is_null() {
                (unsafe { *error = (*pr).error });
            } else {
                (unsafe { free((*pr).error as *mut libc::c_void) });
            }
        }
        1 => {
            item = unsafe { cmdq_get_command((*pr).cmdlist, state) };
            (unsafe { cmdq_insert_after(after, item) });
            (unsafe { cmd_list_free((*pr).cmdlist) });
        }
        _ => {}
    }
    return unsafe { (*pr).status };
}
#[no_mangle]
pub extern "C" fn cmd_parse_and_append(
    mut s: *const i8,
    mut pi: *mut cmd_parse_input,
    mut c: *mut client,
    mut state: *mut cmdq_state,
    mut error: *mut *mut i8,
) -> cmd_parse_status {
    let mut pr: *mut cmd_parse_result = std::ptr::null_mut::<cmd_parse_result>();
    let mut item: *mut cmdq_item = std::ptr::null_mut::<cmdq_item>();
    pr = cmd_parse_from_string(s, pi);
    match (unsafe { (*pr).status }) as u32 {
        0 => {
            if !error.is_null() {
                (unsafe { *error = (*pr).error });
            } else {
                (unsafe { free((*pr).error as *mut libc::c_void) });
            }
        }
        1 => {
            item = unsafe { cmdq_get_command((*pr).cmdlist, state) };
            (unsafe { cmdq_append(c, item) });
            (unsafe { cmd_list_free((*pr).cmdlist) });
        }
        _ => {}
    }
    return unsafe { (*pr).status };
}
#[no_mangle]
pub extern "C" fn cmd_parse_from_buffer(
    mut buf: *const libc::c_void,
    mut len: size_t,
    mut pi: *mut cmd_parse_input,
) -> *mut cmd_parse_result {
    static mut pr: cmd_parse_result = cmd_parse_result {
        status: CMD_PARSE_ERROR,
        cmdlist: 0 as *const cmd_list as *mut cmd_list,
        error: 0 as *const i8 as *mut i8,
    };
    let mut input: cmd_parse_input = cmd_parse_input {
        flags: 0,
        file: std::ptr::null::<i8>(),
        line: 0,
        item: std::ptr::null_mut::<cmdq_item>(),
        c: std::ptr::null_mut::<client>(),
        fs: cmd_find_state {
            flags: 0,
            current: std::ptr::null_mut::<cmd_find_state>(),
            s: std::ptr::null_mut::<session>(),
            wl: std::ptr::null_mut::<winlink>(),
            w: std::ptr::null_mut::<window>(),
            wp: std::ptr::null_mut::<window_pane>(),
            idx: 0,
        },
    };
    let mut cmds: *mut cmd_parse_commands = std::ptr::null_mut::<cmd_parse_commands>();
    let mut cause: *mut i8 = std::ptr::null_mut::<i8>();
    if pi.is_null() {
        (unsafe {
            memset(
                &mut input as *mut cmd_parse_input as *mut libc::c_void,
                0 as i32,
                ::core::mem::size_of::<cmd_parse_input>() as u64,
            )
        });
        pi = &mut input;
    }
    (unsafe {
        memset(
            &mut pr as *mut cmd_parse_result as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    if len == 0 as i32 as u64 {
        (unsafe { pr.status = CMD_PARSE_SUCCESS });
        (unsafe { pr.cmdlist = cmd_list_new() });
        return unsafe { &mut pr };
    }
    cmds = cmd_parse_do_buffer(buf as *const i8, len, pi, &mut cause);
    if cmds.is_null() {
        (unsafe { pr.status = CMD_PARSE_ERROR });
        (unsafe { pr.error = cause });
        return unsafe { &mut pr };
    }
    cmd_parse_build_commands(cmds, pi, unsafe { &mut pr });
    cmd_parse_free_commands(cmds);
    return unsafe { &mut pr };
}
#[no_mangle]
pub extern "C" fn cmd_parse_from_arguments(
    mut values: *mut args_value,
    mut count: u_int,
    mut pi: *mut cmd_parse_input,
) -> *mut cmd_parse_result {
    static mut pr: cmd_parse_result = cmd_parse_result {
        status: CMD_PARSE_ERROR,
        cmdlist: 0 as *const cmd_list as *mut cmd_list,
        error: 0 as *const i8 as *mut i8,
    };
    let mut input: cmd_parse_input = cmd_parse_input {
        flags: 0,
        file: std::ptr::null::<i8>(),
        line: 0,
        item: std::ptr::null_mut::<cmdq_item>(),
        c: std::ptr::null_mut::<client>(),
        fs: cmd_find_state {
            flags: 0,
            current: std::ptr::null_mut::<cmd_find_state>(),
            s: std::ptr::null_mut::<session>(),
            wl: std::ptr::null_mut::<winlink>(),
            w: std::ptr::null_mut::<window>(),
            wp: std::ptr::null_mut::<window_pane>(),
            idx: 0,
        },
    };
    let mut cmds: *mut cmd_parse_commands = std::ptr::null_mut::<cmd_parse_commands>();
    let mut cmd: *mut cmd_parse_command = std::ptr::null_mut::<cmd_parse_command>();
    let mut arg: *mut cmd_parse_argument = std::ptr::null_mut::<cmd_parse_argument>();
    let mut i: u_int = 0;
    let mut copy: *mut i8 = std::ptr::null_mut::<i8>();
    let mut size: size_t = 0;
    let mut end: i32 = 0;
    if pi.is_null() {
        (unsafe {
            memset(
                &mut input as *mut cmd_parse_input as *mut libc::c_void,
                0 as i32,
                ::core::mem::size_of::<cmd_parse_input>() as u64,
            )
        });
        pi = &mut input;
    }
    (unsafe {
        memset(
            &mut pr as *mut cmd_parse_result as *mut libc::c_void,
            0 as i32,
            ::core::mem::size_of::<cmd_parse_result>() as u64,
        )
    });
    cmds = cmd_parse_new_commands();
    cmd = (unsafe {
        xcalloc(
            1 as i32 as size_t,
            ::core::mem::size_of::<cmd_parse_command>() as u64,
        )
    }) as *mut cmd_parse_command;
    (unsafe { (*cmd).line = (*pi).line });
    (unsafe { (*cmd).arguments.tqh_first = std::ptr::null_mut::<cmd_parse_argument>() });
    (unsafe { (*cmd).arguments.tqh_last = &mut (*cmd).arguments.tqh_first });
    i = 0 as i32 as u_int;
    while i < count {
        end = 0 as i32;
        if (unsafe { (*values.offset(i as isize)).type_0 }) as u32 == ARGS_STRING as i32 as u32 {
            copy = unsafe { xstrdup((*values.offset(i as isize)).c2rust_unnamed.string) };
            size = unsafe { strlen(copy) };
            if size != 0 as i32 as u64
                && (unsafe { *copy.offset(size.wrapping_sub(1 as i32 as u64) as isize) }) as i32
                    == ';' as i32
            {
                size = size.wrapping_sub(1);
                (unsafe { *copy.offset(size as isize) = '\0' as i32 as i8 });
                if size > 0 as i32 as u64
                    && (unsafe { *copy.offset(size.wrapping_sub(1 as i32 as u64) as isize) }) as i32
                        == '\\' as i32
                {
                    (unsafe {
                        *copy.offset(size.wrapping_sub(1 as i32 as u64) as isize) = ';' as i32 as i8
                    });
                } else {
                    end = 1 as i32;
                }
            }
            if end == 0 || size != 0 as i32 as u64 {
                arg = (unsafe {
                    xcalloc(
                        1 as i32 as size_t,
                        ::core::mem::size_of::<cmd_parse_argument>() as u64,
                    )
                }) as *mut cmd_parse_argument;
                (unsafe { (*arg).type_0 = CMD_PARSE_STRING });
                (unsafe { (*arg).string = copy });
                (unsafe { (*arg).entry.tqe_next = std::ptr::null_mut::<cmd_parse_argument>() });
                (unsafe { (*arg).entry.tqe_prev = (*cmd).arguments.tqh_last });
                (unsafe { *(*cmd).arguments.tqh_last = arg });
                (unsafe { (*cmd).arguments.tqh_last = &mut (*arg).entry.tqe_next });
            } else {
                (unsafe { free(copy as *mut libc::c_void) });
            }
        } else if (unsafe { (*values.offset(i as isize)).type_0 }) as u32
            == ARGS_COMMANDS as i32 as u32
        {
            arg = (unsafe {
                xcalloc(
                    1 as i32 as size_t,
                    ::core::mem::size_of::<cmd_parse_argument>() as u64,
                )
            }) as *mut cmd_parse_argument;
            (unsafe { (*arg).type_0 = CMD_PARSE_PARSED_COMMANDS });
            (unsafe { (*arg).cmdlist = (*values.offset(i as isize)).c2rust_unnamed.cmdlist });
            (unsafe { (*(*arg).cmdlist).references += 1 });
            (unsafe { (*arg).entry.tqe_next = std::ptr::null_mut::<cmd_parse_argument>() });
            (unsafe { (*arg).entry.tqe_prev = (*cmd).arguments.tqh_last });
            (unsafe { *(*cmd).arguments.tqh_last = arg });
            (unsafe { (*cmd).arguments.tqh_last = &mut (*arg).entry.tqe_next });
        } else {
            (unsafe { fatalx(b"unknown argument type\0" as *const u8 as *const i8) });
        }
        if end != 0 {
            (unsafe { (*cmd).entry.tqe_next = std::ptr::null_mut::<cmd_parse_command>() });
            (unsafe { (*cmd).entry.tqe_prev = (*cmds).tqh_last });
            (unsafe { *(*cmds).tqh_last = cmd });
            (unsafe { (*cmds).tqh_last = &mut (*cmd).entry.tqe_next });
            cmd = (unsafe {
                xcalloc(
                    1 as i32 as size_t,
                    ::core::mem::size_of::<cmd_parse_command>() as u64,
                )
            }) as *mut cmd_parse_command;
            (unsafe { (*cmd).line = (*pi).line });
            (unsafe { (*cmd).arguments.tqh_first = std::ptr::null_mut::<cmd_parse_argument>() });
            (unsafe { (*cmd).arguments.tqh_last = &mut (*cmd).arguments.tqh_first });
        }
        i = i.wrapping_add(1);
    }
    if !(unsafe { (*cmd).arguments.tqh_first }).is_null() {
        (unsafe { (*cmd).entry.tqe_next = std::ptr::null_mut::<cmd_parse_command>() });
        (unsafe { (*cmd).entry.tqe_prev = (*cmds).tqh_last });
        (unsafe { *(*cmds).tqh_last = cmd });
        (unsafe { (*cmds).tqh_last = &mut (*cmd).entry.tqe_next });
    } else {
        (unsafe { free(cmd as *mut libc::c_void) });
    }
    cmd_parse_build_commands(cmds, pi, unsafe { &mut pr });
    cmd_parse_free_commands(cmds);
    return unsafe { &mut pr };
}
unsafe extern "C" fn yyerror(mut fmt: *const i8, mut args: ...) -> i32 {
    let mut ps: *mut cmd_parse_state = &mut parse_state;
    let mut pi: *mut cmd_parse_input = (*ps).input;
    let mut ap: ::core::ffi::VaListImpl;
    let mut error: *mut i8 = std::ptr::null_mut::<i8>();
    if !((*ps).error).is_null() {
        return 0 as i32;
    }
    ap = args.clone();
    xvasprintf(&mut error, fmt, ap.as_va_list());
    (*ps).error = cmd_parse_get_error((*pi).file, (*pi).line, error);
    free(error as *mut libc::c_void);
    return 0 as i32;
}
extern "C" fn yylex_is_var(mut ch: i8, mut first: i32) -> i32 {
    if ch as i32 == '=' as i32 {
        return 0 as i32;
    }
    if first != 0
        && (unsafe { *(*__ctype_b_loc()).offset(ch as u_char as i32 as isize) }) as i32
            & _ISdigit as i32 as u16 as i32
            != 0
    {
        return 0 as i32;
    }
    return ((unsafe { *(*__ctype_b_loc()).offset(ch as u_char as i32 as isize) }) as i32
        & _ISalnum as i32 as u16 as i32
        != 0
        || ch as i32 == '_' as i32) as i32;
}
extern "C" fn yylex_append(
    mut buf: *mut *mut i8,
    mut len: *mut size_t,
    mut add: *const i8,
    mut addlen: size_t,
) {
    if addlen > (18446744073709551615 as u64).wrapping_sub(1 as i32 as u64)
        || (unsafe { *len })
            > (18446744073709551615 as u64)
                .wrapping_sub(1 as i32 as u64)
                .wrapping_sub(addlen)
    {
        (unsafe { fatalx(b"buffer is too big\0" as *const u8 as *const i8) });
    }
    (unsafe {
        *buf = xrealloc(
            *buf as *mut libc::c_void,
            (*len).wrapping_add(1 as i32 as u64).wrapping_add(addlen),
        ) as *mut i8
    });
    (unsafe {
        memcpy(
            (*buf).offset(*len as isize) as *mut libc::c_void,
            add as *const libc::c_void,
            addlen,
        )
    });
    (unsafe { *len = (*len as u64).wrapping_add(addlen) as size_t as size_t });
}
extern "C" fn yylex_append1(mut buf: *mut *mut i8, mut len: *mut size_t, mut add: i8) {
    yylex_append(buf, len, &mut add, 1 as i32 as size_t);
}
extern "C" fn yylex_getc1() -> i32 {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    let mut ch: i32 = 0;
    if !(unsafe { (*ps).f }).is_null() {
        ch = unsafe { getc((*ps).f) };
    } else if (unsafe { (*ps).off }) == (unsafe { (*ps).len }) {
        ch = -(1 as i32);
    } else {
        let fresh4 = unsafe { (*ps).off };
        (unsafe { (*ps).off = ((*ps).off).wrapping_add(1) });
        ch = (unsafe { *((*ps).buf).offset(fresh4 as isize) }) as i32;
    }
    return ch;
}
extern "C" fn yylex_ungetc(mut ch: i32) {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    if !(unsafe { (*ps).f }).is_null() {
        (unsafe { ungetc(ch, (*ps).f) });
    } else if (unsafe { (*ps).off }) > 0 as i32 as u64 && ch != -(1 as i32) {
        (unsafe { (*ps).off = ((*ps).off).wrapping_sub(1) });
    }
}
extern "C" fn yylex_getc() -> i32 {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    let mut ch: i32 = 0;
    if (unsafe { (*ps).escapes }) != 0 as i32 as u32 {
        (unsafe { (*ps).escapes = ((*ps).escapes).wrapping_sub(1) });
        return '\\' as i32;
    }
    loop {
        ch = yylex_getc1();
        if ch == '\\' as i32 {
            (unsafe { (*ps).escapes = ((*ps).escapes).wrapping_add(1) });
        } else if ch == '\n' as i32
            && (unsafe { (*ps).escapes }).wrapping_rem(2 as i32 as u32) == 1 as i32 as u32
        {
            (unsafe { (*(*ps).input).line = ((*(*ps).input).line).wrapping_add(1) });
            (unsafe { (*ps).escapes = ((*ps).escapes).wrapping_sub(1) });
        } else {
            if (unsafe { (*ps).escapes }) != 0 as i32 as u32 {
                yylex_ungetc(ch);
                (unsafe { (*ps).escapes = ((*ps).escapes).wrapping_sub(1) });
                return '\\' as i32;
            }
            return ch;
        }
    }
}
extern "C" fn yylex_get_word(mut ch: i32) -> *mut i8 {
    let mut buf: *mut i8 = std::ptr::null_mut::<i8>();
    let mut len: size_t = 0;
    len = 0 as i32 as size_t;
    buf = (unsafe { xmalloc(1 as i32 as size_t) }) as *mut i8;
    loop {
        yylex_append1(&mut buf, &mut len, ch as i8);
        ch = yylex_getc();
        if !(ch != -(1 as i32)
            && (unsafe { strchr(b" \t\n\0" as *const u8 as *const i8, ch) }).is_null())
        {
            break;
        }
    }
    yylex_ungetc(ch);
    (unsafe { *buf.offset(len as isize) = '\0' as i32 as i8 });
    (unsafe {
        log_debug(
            b"%s: %s\0" as *const u8 as *const i8,
            (*::core::mem::transmute::<&[u8; 15], &[i8; 15]>(b"yylex_get_word\0")).as_ptr(),
            buf,
        )
    });
    return buf;
}
extern "C" fn yylex() -> i32 {
    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
    let mut token: *mut i8 = std::ptr::null_mut::<i8>();
    let mut cp: *mut i8 = std::ptr::null_mut::<i8>();
    let mut ch: i32 = 0;
    let mut next: i32 = 0;
    let mut condition: i32 = 0;
    if (unsafe { (*ps).eol }) != 0 {
        (unsafe { (*(*ps).input).line = ((*(*ps).input).line).wrapping_add(1) });
    }
    (unsafe { (*ps).eol = 0 as i32 });
    condition = unsafe { (*ps).condition };
    (unsafe { (*ps).condition = 0 as i32 });
    loop {
        ch = yylex_getc();
        if ch == -(1 as i32) {
            if (unsafe { (*ps).eof }) != 0 {
                break;
            }
            (unsafe { (*ps).eof = 1 as i32 });
            return '\n' as i32;
        } else {
            if ch == ' ' as i32 || ch == '\t' as i32 {
                continue;
            }
            if ch == '\r' as i32 {
                ch = yylex_getc();
                if ch != '\n' as i32 {
                    yylex_ungetc(ch);
                    ch = '\r' as i32;
                }
            }
            if ch == '\n' as i32 {
                (unsafe { (*ps).eol = 1 as i32 });
                return '\n' as i32;
            }
            if ch == ';' as i32 || ch == '{' as i32 || ch == '}' as i32 {
                return ch;
            }
            if ch == '#' as i32 {
                next = yylex_getc();
                if condition != 0 && next == '{' as i32 {
                    (unsafe { yylval.token = yylex_format() });
                    if (unsafe { yylval.token }).is_null() {
                        return 257 as i32;
                    }
                    return 263 as i32;
                }
                while next != '\n' as i32 && next != -(1 as i32) {
                    next = yylex_getc();
                }
                if next == '\n' as i32 {
                    (unsafe { (*(*ps).input).line = ((*(*ps).input).line).wrapping_add(1) });
                    return '\n' as i32;
                }
            } else {
                if ch == '%' as i32 {
                    (unsafe { yylval.token = yylex_get_word('%' as i32) });
                    cp = unsafe { yylval.token };
                    while (unsafe { *cp }) as i32 != '\0' as i32 {
                        if (unsafe { *cp }) as i32 != '%' as i32
                            && (unsafe {
                                *(*__ctype_b_loc()).offset(*cp as u_char as i32 as isize)
                            }) as i32
                                & _ISdigit as i32 as u16 as i32
                                == 0
                        {
                            break;
                        }
                        cp = unsafe { cp.offset(1) };
                    }
                    if (unsafe { *cp }) as i32 == '\0' as i32 {
                        return 264 as i32;
                    }
                    (unsafe { (*ps).condition = 1 as i32 });
                    if (unsafe { strcmp(yylval.token, b"%hidden\0" as *const u8 as *const i8) })
                        == 0 as i32
                    {
                        (unsafe { free(yylval.token as *mut libc::c_void) });
                        return 258 as i32;
                    }
                    if (unsafe { strcmp(yylval.token, b"%if\0" as *const u8 as *const i8) })
                        == 0 as i32
                    {
                        (unsafe { free(yylval.token as *mut libc::c_void) });
                        return 259 as i32;
                    }
                    if (unsafe { strcmp(yylval.token, b"%else\0" as *const u8 as *const i8) })
                        == 0 as i32
                    {
                        (unsafe { free(yylval.token as *mut libc::c_void) });
                        return 260 as i32;
                    }
                    if (unsafe { strcmp(yylval.token, b"%elif\0" as *const u8 as *const i8) })
                        == 0 as i32
                    {
                        (unsafe { free(yylval.token as *mut libc::c_void) });
                        return 261 as i32;
                    }
                    if (unsafe { strcmp(yylval.token, b"%endif\0" as *const u8 as *const i8) })
                        == 0 as i32
                    {
                        (unsafe { free(yylval.token as *mut libc::c_void) });
                        return 262 as i32;
                    }
                    (unsafe { free(yylval.token as *mut libc::c_void) });
                    return 257 as i32;
                }
                token = yylex_token(ch);
                if token.is_null() {
                    return 257 as i32;
                }
                (unsafe { yylval.token = token });
                if !(unsafe { strchr(token, '=' as i32) }).is_null()
                    && yylex_is_var(unsafe { *token }, 1 as i32) != 0
                {
                    cp = unsafe { token.offset(1 as i32 as isize) };
                    while (unsafe { *cp }) as i32 != '=' as i32 {
                        if yylex_is_var(unsafe { *cp }, 0 as i32) == 0 {
                            break;
                        }
                        cp = unsafe { cp.offset(1) };
                    }
                    if (unsafe { *cp }) as i32 == '=' as i32 {
                        return 265 as i32;
                    }
                }
                return 264 as i32;
            }
        }
    }
    return 0 as i32;
}
extern "C" fn yylex_format() -> *mut i8 {
    let mut current_block: u64;
    let mut buf: *mut i8 = std::ptr::null_mut::<i8>();
    let mut len: size_t = 0;
    let mut ch: i32 = 0;
    let mut brackets: i32 = 1 as i32;
    len = 0 as i32 as size_t;
    buf = (unsafe { xmalloc(1 as i32 as size_t) }) as *mut i8;
    yylex_append(
        &mut buf,
        &mut len,
        b"#{\0" as *const u8 as *const i8,
        2 as i32 as size_t,
    );
    loop {
        ch = yylex_getc();
        if ch == -(1 as i32) || ch == '\n' as i32 {
            current_block = 6728653361643524790;
            break;
        }
        if ch == '#' as i32 {
            ch = yylex_getc();
            if ch == -(1 as i32) || ch == '\n' as i32 {
                current_block = 6728653361643524790;
                break;
            }
            if ch == '{' as i32 {
                brackets += 1;
            }
            yylex_append1(&mut buf, &mut len, '#' as i32 as i8);
        } else if ch == '}' as i32 {
            if brackets != 0 as i32 && {
                brackets -= 1;
                brackets == 0 as i32
            } {
                yylex_append1(&mut buf, &mut len, ch as i8);
                current_block = 10048703153582371463;
                break;
            }
        }
        yylex_append1(&mut buf, &mut len, ch as i8);
    }
    match current_block {
        10048703153582371463 => {
            if brackets == 0 as i32 {
                (unsafe { *buf.offset(len as isize) = '\0' as i32 as i8 });
                (unsafe {
                    log_debug(
                        b"%s: %s\0" as *const u8 as *const i8,
                        (*::core::mem::transmute::<&[u8; 13], &[i8; 13]>(b"yylex_format\0"))
                            .as_ptr(),
                        buf,
                    )
                });
                return buf;
            }
        }
        _ => {}
    }
    (unsafe { free(buf as *mut libc::c_void) });
    return std::ptr::null_mut::<i8>();
}
extern "C" fn yylex_token_escape(mut buf: *mut *mut i8, mut len: *mut size_t) -> i32 {
    let mut current_block: u64;
    let mut ch: i32 = 0;
    let mut type_0: i32 = 0;
    let mut o2: i32 = 0;
    let mut o3: i32 = 0;
    let mut mlen: i32 = 0;
    let mut size: u_int = 0;
    let mut i: u_int = 0;
    let mut tmp: u_int = 0;
    let mut s: [i8; 9] = [0; 9];
    let mut m: [i8; 16] = [0; 16];
    ch = yylex_getc();
    if ch >= '4' as i32 && ch <= '7' as i32 {
        (unsafe { yyerror(b"invalid octal escape\0" as *const u8 as *const i8) });
        return 0 as i32;
    }
    if ch >= '0' as i32 && ch <= '3' as i32 {
        o2 = yylex_getc();
        if o2 >= '0' as i32 && o2 <= '7' as i32 {
            o3 = yylex_getc();
            if o3 >= '0' as i32 && o3 <= '7' as i32 {
                ch = 64 as i32 * (ch - '0' as i32)
                    + 8 as i32 * (o2 - '0' as i32)
                    + (o3 - '0' as i32);
                yylex_append1(buf, len, ch as i8);
                return 1 as i32;
            }
        }
        (unsafe { yyerror(b"invalid octal escape\0" as *const u8 as *const i8) });
        return 0 as i32;
    }
    match ch {
        -1 => return 0 as i32,
        97 => {
            ch = '\u{7}' as i32;
            current_block = 17281240262373992796;
        }
        98 => {
            ch = '\u{8}' as i32;
            current_block = 17281240262373992796;
        }
        101 => {
            ch = '\u{1b}' as i32;
            current_block = 17281240262373992796;
        }
        102 => {
            ch = '\u{c}' as i32;
            current_block = 17281240262373992796;
        }
        115 => {
            ch = ' ' as i32;
            current_block = 17281240262373992796;
        }
        118 => {
            ch = '\u{b}' as i32;
            current_block = 17281240262373992796;
        }
        114 => {
            ch = '\r' as i32;
            current_block = 17281240262373992796;
        }
        110 => {
            ch = '\n' as i32;
            current_block = 17281240262373992796;
        }
        116 => {
            ch = '\t' as i32;
            current_block = 17281240262373992796;
        }
        117 => {
            type_0 = 'u' as i32;
            size = 4 as i32 as u_int;
            current_block = 52005249763565056;
        }
        85 => {
            type_0 = 'U' as i32;
            size = 8 as i32 as u_int;
            current_block = 52005249763565056;
        }
        _ => {
            current_block = 17281240262373992796;
        }
    }
    match current_block {
        52005249763565056 => {
            i = 0 as i32 as u_int;
            while i < size {
                ch = yylex_getc();
                if ch == -(1 as i32) || ch == '\n' as i32 {
                    return 0 as i32;
                }
                if (unsafe { *(*__ctype_b_loc()).offset(ch as u_char as i32 as isize) }) as i32
                    & _ISxdigit as i32 as u16 as i32
                    == 0
                {
                    (unsafe {
                        yyerror(b"invalid \\%c argument\0" as *const u8 as *const i8, type_0)
                    });
                    return 0 as i32;
                }
                s[i as usize] = ch as i8;
                i = i.wrapping_add(1);
            }
            s[i as usize] = '\0' as i32 as i8;
            if size == 4 as i32 as u32
                && (unsafe {
                    sscanf(
                        s.as_mut_ptr(),
                        b"%4x\0" as *const u8 as *const i8,
                        &mut tmp as *mut u_int,
                    )
                }) != 1 as i32
                || size == 8 as i32 as u32
                    && (unsafe {
                        sscanf(
                            s.as_mut_ptr(),
                            b"%8x\0" as *const u8 as *const i8,
                            &mut tmp as *mut u_int,
                        )
                    }) != 1 as i32
            {
                (unsafe { yyerror(b"invalid \\%c argument\0" as *const u8 as *const i8, type_0) });
                return 0 as i32;
            }
            mlen = unsafe { wctomb(m.as_mut_ptr(), tmp as wchar_t) };
            if mlen <= 0 as i32 || mlen > ::core::mem::size_of::<[i8; 16]>() as u64 as i32 {
                (unsafe { yyerror(b"invalid \\%c argument\0" as *const u8 as *const i8, type_0) });
                return 0 as i32;
            }
            yylex_append(buf, len, m.as_mut_ptr(), mlen as size_t);
            return 1 as i32;
        }
        _ => {
            yylex_append1(buf, len, ch as i8);
            return 1 as i32;
        }
    };
}
extern "C" fn yylex_token_variable(mut buf: *mut *mut i8, mut len: *mut size_t) -> i32 {
    let mut envent: *mut environ_entry = std::ptr::null_mut::<environ_entry>();
    let mut ch: i32 = 0;
    let mut brackets: i32 = 0 as i32;
    let mut name: [i8; 1024] = [0; 1024];
    let mut namelen: size_t = 0 as i32 as size_t;
    let mut value: *const i8 = std::ptr::null::<i8>();
    ch = yylex_getc();
    if ch == -(1 as i32) {
        return 0 as i32;
    }
    if ch == '{' as i32 {
        brackets = 1 as i32;
    } else {
        if yylex_is_var(ch as i8, 1 as i32) == 0 {
            yylex_append1(buf, len, '$' as i32 as i8);
            yylex_ungetc(ch);
            return 1 as i32;
        }
        let fresh5 = namelen;
        namelen = namelen.wrapping_add(1);
        name[fresh5 as usize] = ch as i8;
    }
    loop {
        ch = yylex_getc();
        if brackets != 0 && ch == '}' as i32 {
            break;
        }
        if ch == -(1 as i32) || yylex_is_var(ch as i8, 0 as i32) == 0 {
            if brackets == 0 {
                yylex_ungetc(ch);
                break;
            } else {
                (unsafe { yyerror(b"invalid environment variable\0" as *const u8 as *const i8) });
                return 0 as i32;
            }
        } else {
            if namelen
                == (::core::mem::size_of::<[i8; 1024]>() as u64).wrapping_sub(2 as i32 as u64)
            {
                (unsafe {
                    yyerror(b"environment variable is too long\0" as *const u8 as *const i8)
                });
                return 0 as i32;
            }
            let fresh6 = namelen;
            namelen = namelen.wrapping_add(1);
            name[fresh6 as usize] = ch as i8;
        }
    }
    name[namelen as usize] = '\0' as i32 as i8;
    envent = unsafe { environ_find(global_environ, name.as_mut_ptr()) };
    if !envent.is_null() && !(unsafe { (*envent).value }).is_null() {
        value = unsafe { (*envent).value };
        (unsafe {
            log_debug(
                b"%s: %s -> %s\0" as *const u8 as *const i8,
                (*::core::mem::transmute::<&[u8; 21], &[i8; 21]>(b"yylex_token_variable\0"))
                    .as_ptr(),
                name.as_mut_ptr(),
                value,
            )
        });
        yylex_append(buf, len, value, unsafe { strlen(value) });
    }
    return 1 as i32;
}
extern "C" fn yylex_token_tilde(mut buf: *mut *mut i8, mut len: *mut size_t) -> i32 {
    let mut envent: *mut environ_entry = std::ptr::null_mut::<environ_entry>();
    let mut ch: i32 = 0;
    let mut name: [i8; 1024] = [0; 1024];
    let mut namelen: size_t = 0 as i32 as size_t;
    let mut pw: *mut passwd = std::ptr::null_mut::<passwd>();
    let mut home: *const i8 = std::ptr::null::<i8>();
    loop {
        ch = yylex_getc();
        if ch == -(1 as i32)
            || !(unsafe { strchr(b"/ \t\n\"'\0" as *const u8 as *const i8, ch) }).is_null()
        {
            yylex_ungetc(ch);
            break;
        } else {
            if namelen
                == (::core::mem::size_of::<[i8; 1024]>() as u64).wrapping_sub(2 as i32 as u64)
            {
                (unsafe { yyerror(b"user name is too long\0" as *const u8 as *const i8) });
                return 0 as i32;
            }
            let fresh7 = namelen;
            namelen = namelen.wrapping_add(1);
            name[fresh7 as usize] = ch as i8;
        }
    }
    name[namelen as usize] = '\0' as i32 as i8;
    if (unsafe { *name.as_mut_ptr() }) as i32 == '\0' as i32 {
        envent = unsafe { environ_find(global_environ, b"HOME\0" as *const u8 as *const i8) };
        if !envent.is_null() && (unsafe { *(*envent).value }) as i32 != '\0' as i32 {
            home = unsafe { (*envent).value };
        } else {
            pw = unsafe { getpwuid(getuid()) };
            if !pw.is_null() {
                home = unsafe { (*pw).pw_dir };
            }
        }
    } else {
        pw = unsafe { getpwnam(name.as_mut_ptr()) };
        if !pw.is_null() {
            home = unsafe { (*pw).pw_dir };
        }
    }
    if home.is_null() {
        return 0 as i32;
    }
    (unsafe {
        log_debug(
            b"%s: ~%s -> %s\0" as *const u8 as *const i8,
            (*::core::mem::transmute::<&[u8; 18], &[i8; 18]>(b"yylex_token_tilde\0")).as_ptr(),
            name.as_mut_ptr(),
            home,
        )
    });
    yylex_append(buf, len, home, unsafe { strlen(home) });
    return 1 as i32;
}
extern "C" fn yylex_token(mut ch: i32) -> *mut i8 {
    let mut current_block: u64;
    let mut buf: *mut i8 = std::ptr::null_mut::<i8>();
    let mut len: size_t = 0;
    let mut state: C2RustUnnamed_43 = NONE;
    let mut last: C2RustUnnamed_43 = START;
    len = 0 as i32 as size_t;
    buf = (unsafe { xmalloc(1 as i32 as size_t) }) as *mut i8;
    loop {
        if ch == -(1 as i32) {
            (unsafe {
                log_debug(
                    b"%s: end at EOF\0" as *const u8 as *const i8,
                    (*::core::mem::transmute::<&[u8; 12], &[i8; 12]>(b"yylex_token\0")).as_ptr(),
                )
            });
            current_block = 14945149239039849694;
            break;
        } else {
            if state as u32 == NONE as i32 as u32 && ch == '\r' as i32 {
                ch = yylex_getc();
                if ch != '\n' as i32 {
                    yylex_ungetc(ch);
                    ch = '\r' as i32;
                }
            }
            if state as u32 == NONE as i32 as u32 && ch == '\n' as i32 {
                (unsafe {
                    log_debug(
                        b"%s: end at EOL\0" as *const u8 as *const i8,
                        (*::core::mem::transmute::<&[u8; 12], &[i8; 12]>(b"yylex_token\0"))
                            .as_ptr(),
                    )
                });
                current_block = 14945149239039849694;
                break;
            } else if state as u32 == NONE as i32 as u32 && (ch == ' ' as i32 || ch == '\t' as i32)
            {
                (unsafe {
                    log_debug(
                        b"%s: end at WS\0" as *const u8 as *const i8,
                        (*::core::mem::transmute::<&[u8; 12], &[i8; 12]>(b"yylex_token\0"))
                            .as_ptr(),
                    )
                });
                current_block = 14945149239039849694;
                break;
            } else if state as u32 == NONE as i32 as u32 && (ch == ';' as i32 || ch == '}' as i32) {
                (unsafe {
                    log_debug(
                        b"%s: end at %c\0" as *const u8 as *const i8,
                        (*::core::mem::transmute::<&[u8; 12], &[i8; 12]>(b"yylex_token\0"))
                            .as_ptr(),
                        ch,
                    )
                });
                current_block = 14945149239039849694;
                break;
            } else if ch == '\n' as i32 && state as u32 != NONE as i32 as u32 {
                yylex_append1(&mut buf, &mut len, '\n' as i32 as i8);
                loop {
                    ch = yylex_getc();
                    if !(ch == ' ' as i32 || ch == '\t' as i32) {
                        break;
                    }
                }
                if ch != '#' as i32 {
                    continue;
                }
                ch = yylex_getc();
                if !(unsafe { strchr(b",#{}:\0" as *const u8 as *const i8, ch) }).is_null() {
                    yylex_ungetc(ch);
                    ch = '#' as i32;
                } else {
                    loop {
                        ch = yylex_getc();
                        if !(ch != '\n' as i32 && ch != -(1 as i32)) {
                            break;
                        }
                    }
                }
            } else {
                if ch == '\\' as i32 && state as u32 != SINGLE_QUOTES as i32 as u32 {
                    if yylex_token_escape(&mut buf, &mut len) == 0 {
                        current_block = 5103725185896625415;
                        break;
                    }
                    current_block = 2073361325573835688;
                } else if ch == '~' as i32
                    && last as u32 != state as u32
                    && state as u32 != SINGLE_QUOTES as i32 as u32
                {
                    if yylex_token_tilde(&mut buf, &mut len) == 0 {
                        current_block = 5103725185896625415;
                        break;
                    }
                    current_block = 2073361325573835688;
                } else if ch == '$' as i32 && state as u32 != SINGLE_QUOTES as i32 as u32 {
                    if yylex_token_variable(&mut buf, &mut len) == 0 {
                        current_block = 5103725185896625415;
                        break;
                    }
                    current_block = 2073361325573835688;
                } else {
                    if ch == '}' as i32 && state as u32 == NONE as i32 as u32 {
                        current_block = 5103725185896625415;
                        break;
                    }
                    if ch == '\'' as i32 {
                        if state as u32 == NONE as i32 as u32 {
                            state = SINGLE_QUOTES;
                            current_block = 1365710079932356179;
                        } else if state as u32 == SINGLE_QUOTES as i32 as u32 {
                            state = NONE;
                            current_block = 1365710079932356179;
                        } else {
                            current_block = 18435049525520518667;
                        }
                    } else {
                        current_block = 18435049525520518667;
                    }
                    match current_block {
                        1365710079932356179 => {}
                        _ => {
                            if ch == '"' as i32 {
                                if state as u32 == NONE as i32 as u32 {
                                    state = DOUBLE_QUOTES;
                                    current_block = 1365710079932356179;
                                } else if state as u32 == DOUBLE_QUOTES as i32 as u32 {
                                    state = NONE;
                                    current_block = 1365710079932356179;
                                } else {
                                    current_block = 6174974146017752131;
                                }
                            } else {
                                current_block = 6174974146017752131;
                            }
                            match current_block {
                                1365710079932356179 => {}
                                _ => {
                                    yylex_append1(&mut buf, &mut len, ch as i8);
                                    current_block = 2073361325573835688;
                                }
                            }
                        }
                    }
                }
                match current_block {
                    2073361325573835688 => {
                        last = state;
                    }
                    _ => {}
                }
                ch = yylex_getc();
            }
        }
    }
    match current_block {
        5103725185896625415 => {
            (unsafe { free(buf as *mut libc::c_void) });
            return std::ptr::null_mut::<i8>();
        }
        _ => {
            yylex_ungetc(ch);
            (unsafe { *buf.offset(len as isize) = '\0' as i32 as i8 });
            (unsafe {
                log_debug(
                    b"%s: %s\0" as *const u8 as *const i8,
                    (*::core::mem::transmute::<&[u8; 12], &[i8; 12]>(b"yylex_token\0")).as_ptr(),
                    buf,
                )
            });
            return buf;
        }
    };
}
extern "C" fn yygrowstack(mut data: *mut YYSTACKDATA) -> i32 {
    let mut i: i32 = 0;
    let mut newsize: u32 = 0;
    let mut newss: *mut YYINT = std::ptr::null_mut::<YYINT>();
    let mut newvs: *mut YYSTYPE = std::ptr::null_mut::<YYSTYPE>();
    newsize = unsafe { (*data).stacksize };
    if newsize == 0 as i32 as u32 {
        newsize = 200 as i32 as u32;
    } else if newsize >= 10000 as i32 as u32 {
        return -(2 as i32);
    } else {
        newsize = newsize.wrapping_mul(2 as i32 as u32);
        if newsize > 10000 as i32 as u32 {
            newsize = 10000 as i32 as u32;
        }
    }
    i = (unsafe { ((*data).s_mark).offset_from((*data).s_base) }) as i64 as i32;
    newss = (unsafe {
        realloc(
            (*data).s_base as *mut libc::c_void,
            (newsize as u64).wrapping_mul(::core::mem::size_of::<YYINT>() as u64),
        )
    }) as *mut YYINT;
    if newss.is_null() {
        return -(2 as i32);
    }
    (unsafe { (*data).s_base = newss });
    (unsafe { (*data).s_mark = newss.offset(i as isize) });
    newvs = (unsafe {
        realloc(
            (*data).l_base as *mut libc::c_void,
            (newsize as u64).wrapping_mul(::core::mem::size_of::<YYSTYPE>() as u64),
        )
    }) as *mut YYSTYPE;
    if newvs.is_null() {
        return -(2 as i32);
    }
    (unsafe { (*data).l_base = newvs });
    (unsafe { (*data).l_mark = newvs.offset(i as isize) });
    (unsafe { (*data).stacksize = newsize });
    (unsafe {
        (*data).s_last = ((*data).s_base)
            .offset(newsize as isize)
            .offset(-(1 as i32 as isize))
    });
    return 0 as i32;
}
extern "C" fn yyparse() -> i32 {
    let mut current_block: u64;
    let mut yym: i32 = 0;
    let mut yyn: i32 = 0;
    let mut yystate: i32 = 0;
    let mut yyresult: i32 = 0;
    yym = 0 as i32;
    (unsafe { yynerrs = 0 as i32 });
    (unsafe { yyerrflag = 0 as i32 });
    (unsafe { yychar = -(1 as i32) });
    yystate = 0 as i32;
    if (unsafe { yystack.s_base }).is_null() && yygrowstack(unsafe { &mut yystack }) == -(2 as i32)
    {
        current_block = 17613755028756935485;
    } else {
        (unsafe { yystack.s_mark = yystack.s_base });
        (unsafe { yystack.l_mark = yystack.l_base });
        yystate = 0 as i32;
        (unsafe { *yystack.s_mark = 0 as i32 });
        '_yyloop: loop {
            yyn = unsafe { yydefred[yystate as usize] };
            if yyn == 0 as i32 {
                if (unsafe { yychar }) < 0 as i32 {
                    (unsafe { yychar = yylex() });
                    if (unsafe { yychar }) < 0 as i32 {
                        (unsafe { yychar = 0 as i32 });
                    }
                }
                yyn = unsafe { yysindex[yystate as usize] };
                if yyn != 0 as i32
                    && {
                        yyn += unsafe { yychar };
                        yyn >= 0 as i32
                    }
                    && yyn <= 277 as i32
                    && (unsafe { yycheck[yyn as usize] }) == (unsafe { yychar })
                {
                    if (unsafe { yystack.s_mark }) >= (unsafe { yystack.s_last })
                        && yygrowstack(unsafe { &mut yystack }) == -(2 as i32)
                    {
                        current_block = 17613755028756935485;
                        break;
                    }
                    yystate = unsafe { yytable[yyn as usize] };
                    (unsafe { yystack.s_mark = (yystack.s_mark).offset(1) });
                    (unsafe { *yystack.s_mark = yytable[yyn as usize] });
                    (unsafe { yystack.l_mark = (yystack.l_mark).offset(1) });
                    (unsafe { *yystack.l_mark = yylval });
                    (unsafe { yychar = -(1 as i32) });
                    if (unsafe { yyerrflag }) > 0 as i32 {
                        (unsafe { yyerrflag -= 1 });
                    }
                    continue;
                } else {
                    yyn = unsafe { yyrindex[yystate as usize] };
                    if yyn != 0 as i32
                        && {
                            yyn += unsafe { yychar };
                            yyn >= 0 as i32
                        }
                        && yyn <= 277 as i32
                        && (unsafe { yycheck[yyn as usize] }) == (unsafe { yychar })
                    {
                        yyn = unsafe { yytable[yyn as usize] };
                    } else {
                        if (unsafe { yyerrflag }) == 0 as i32 {
                            (unsafe { yyerror(b"syntax error\0" as *const u8 as *const i8) });
                            (unsafe { yynerrs += 1 });
                        }
                        if (unsafe { yyerrflag }) < 3 as i32 {
                            (unsafe { yyerrflag = 3 as i32 });
                            loop {
                                yyn = unsafe { yysindex[*yystack.s_mark as usize] };
                                if yyn != 0 as i32
                                    && {
                                        yyn += 256 as i32;
                                        yyn >= 0 as i32
                                    }
                                    && yyn <= 277 as i32
                                    && (unsafe { yycheck[yyn as usize] }) == 256 as i32
                                {
                                    if (unsafe { yystack.s_mark }) >= (unsafe { yystack.s_last })
                                        && yygrowstack(unsafe { &mut yystack }) == -(2 as i32)
                                    {
                                        current_block = 17613755028756935485;
                                        break '_yyloop;
                                    }
                                    yystate = unsafe { yytable[yyn as usize] };
                                    (unsafe { yystack.s_mark = (yystack.s_mark).offset(1) });
                                    (unsafe { *yystack.s_mark = yytable[yyn as usize] });
                                    (unsafe { yystack.l_mark = (yystack.l_mark).offset(1) });
                                    (unsafe { *yystack.l_mark = yylval });
                                    continue '_yyloop;
                                } else {
                                    if (unsafe { yystack.s_mark }) <= (unsafe { yystack.s_base }) {
                                        current_block = 13132403383911580041;
                                        break '_yyloop;
                                    }
                                    (unsafe { yystack.s_mark = (yystack.s_mark).offset(-1) });
                                    (unsafe { yystack.l_mark = (yystack.l_mark).offset(-1) });
                                }
                            }
                        } else {
                            if (unsafe { yychar }) == 0 as i32 {
                                current_block = 13132403383911580041;
                                break;
                            }
                            (unsafe { yychar = -(1 as i32) });
                            continue;
                        }
                    }
                }
            }
            yym = unsafe { yylen[yyn as usize] };
            if yym > 0 as i32 {
                (unsafe { yyval = *(yystack.l_mark).offset((1 as i32 - yym) as isize) });
            } else {
                (unsafe {
                    memset(
                        &mut yyval as *mut YYSTYPE as *mut libc::c_void,
                        0 as i32,
                        ::core::mem::size_of::<YYSTYPE>() as u64,
                    )
                });
            }
            match yyn {
                2 => {
                    let mut ps: *mut cmd_parse_state = unsafe { &mut parse_state };
                    (unsafe {
                        (*ps).commands = (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                    });
                }
                3 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                    });
                }
                4 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                    });
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands).tqh_first
                    })
                    .is_null()
                    {
                        (unsafe {
                            *(*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                    .tqh_first
                        });
                        let fresh8 = unsafe {
                            &mut (*(*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first)
                                .entry
                                .tqe_prev
                        };
                        *fresh8 = unsafe { (*yyval.commands).tqh_last };
                        (unsafe {
                            (*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                    .tqh_last
                        });
                        let fresh9 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first
                        };
                        *fresh9 = std::ptr::null_mut::<cmd_parse_command>();
                        let fresh10 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_last
                        };
                        *fresh10 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first
                        };
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                                as *mut libc::c_void,
                        )
                    });
                }
                5 => {
                    (unsafe {
                        yyval.commands = xmalloc(::core::mem::size_of::<cmd_parse_commands>() as u64)
                            as *mut cmd_parse_commands
                    });
                    (unsafe {
                        (*yyval.commands).tqh_first = std::ptr::null_mut::<cmd_parse_command>()
                    });
                    (unsafe { (*yyval.commands).tqh_last = &mut (*yyval.commands).tqh_first });
                }
                6 => {
                    (unsafe {
                        yyval.commands = xmalloc(::core::mem::size_of::<cmd_parse_commands>() as u64)
                            as *mut cmd_parse_commands
                    });
                    (unsafe {
                        (*yyval.commands).tqh_first = std::ptr::null_mut::<cmd_parse_command>()
                    });
                    (unsafe { (*yyval.commands).tqh_last = &mut (*yyval.commands).tqh_first });
                }
                7 => {
                    let mut ps_0: *mut cmd_parse_state = unsafe { &mut parse_state };
                    if (unsafe { (*ps_0).scope }).is_null()
                        || (unsafe { (*(*ps_0).scope).flag }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    }
                }
                8 => {
                    let mut ps_1: *mut cmd_parse_state = unsafe { &mut parse_state };
                    if (unsafe { (*ps_1).scope }).is_null()
                        || (unsafe { (*(*ps_1).scope).flag }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    }
                }
                9 => {
                    (unsafe { yyval.token = (*(yystack.l_mark).offset(0 as i32 as isize)).token });
                }
                10 => {
                    (unsafe { yyval.token = (*(yystack.l_mark).offset(0 as i32 as isize)).token });
                }
                11 => {
                    let mut ps_2: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut pi: *mut cmd_parse_input = unsafe { (*ps_2).input };
                    let mut ft: *mut format_tree = std::ptr::null_mut::<format_tree>();
                    let mut c: *mut client = unsafe { (*pi).c };
                    let mut fsp: *mut cmd_find_state = std::ptr::null_mut::<cmd_find_state>();
                    let mut fs: cmd_find_state = cmd_find_state {
                        flags: 0,
                        current: std::ptr::null_mut::<cmd_find_state>(),
                        s: std::ptr::null_mut::<session>(),
                        wl: std::ptr::null_mut::<winlink>(),
                        w: std::ptr::null_mut::<window>(),
                        wp: std::ptr::null_mut::<window_pane>(),
                        idx: 0,
                    };
                    let mut flags: i32 = 0x4 as i32;
                    if (unsafe { cmd_find_valid_state(&mut (*pi).fs) }) != 0 {
                        fsp = unsafe { &mut (*pi).fs };
                    } else {
                        (unsafe { cmd_find_from_client(&mut fs, c, 0 as i32) });
                        fsp = &mut fs;
                    }
                    ft = unsafe {
                        format_create(std::ptr::null_mut::<client>(), (*pi).item, 0 as i32, flags)
                    };
                    (unsafe { format_defaults(ft, c, (*fsp).s, (*fsp).wl, (*fsp).wp) });
                    (unsafe {
                        yyval.token =
                            format_expand(ft, (*(yystack.l_mark).offset(0 as i32 as isize)).token)
                    });
                    (unsafe { format_free(ft) });
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                                as *mut libc::c_void,
                        )
                    });
                }
                14 => {
                    let mut ps_3: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut flags_0: i32 = unsafe { (*(*ps_3).input).flags };
                    let mut flag: i32 = 1 as i32;
                    let mut scope: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
                    if !(unsafe { (*ps_3).scope }).is_null() {
                        flag = unsafe { (*(*ps_3).scope).flag };
                        scope = unsafe { (*ps_3).stack.tqh_first };
                        while !scope.is_null() {
                            flag = (flag != 0 && (unsafe { (*scope).flag }) != 0) as i32;
                            scope = unsafe { (*scope).entry.tqe_next };
                        }
                    }
                    if !flags_0 & 0x2 as i32 != 0 && flag != 0 {
                        (unsafe {
                            environ_put(
                                global_environ,
                                (*(yystack.l_mark).offset(0 as i32 as isize)).token,
                                0 as i32,
                            )
                        });
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                                as *mut libc::c_void,
                        )
                    });
                }
                15 => {
                    let mut ps_4: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut flags_1: i32 = unsafe { (*(*ps_4).input).flags };
                    let mut flag_0: i32 = 1 as i32;
                    let mut scope_0: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
                    if !(unsafe { (*ps_4).scope }).is_null() {
                        flag_0 = unsafe { (*(*ps_4).scope).flag };
                        scope_0 = unsafe { (*ps_4).stack.tqh_first };
                        while !scope_0.is_null() {
                            flag_0 = (flag_0 != 0 && (unsafe { (*scope_0).flag }) != 0) as i32;
                            scope_0 = unsafe { (*scope_0).entry.tqe_next };
                        }
                    }
                    if !flags_1 & 0x2 as i32 != 0 && flag_0 != 0 {
                        (unsafe {
                            environ_put(
                                global_environ,
                                (*(yystack.l_mark).offset(0 as i32 as isize)).token,
                                0x1 as i32,
                            )
                        });
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                                as *mut libc::c_void,
                        )
                    });
                }
                16 => {
                    let mut ps_5: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut scope_1: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
                    scope_1 = (unsafe { xmalloc(::core::mem::size_of::<cmd_parse_scope>() as u64) })
                        as *mut cmd_parse_scope;
                    (unsafe {
                        (*scope_1).flag =
                            format_true((*(yystack.l_mark).offset(0 as i32 as isize)).token)
                    });
                    (unsafe { yyval.flag = (*scope_1).flag });
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                                as *mut libc::c_void,
                        )
                    });
                    if !(unsafe { (*ps_5).scope }).is_null() {
                        (unsafe { (*(*ps_5).scope).entry.tqe_next = (*ps_5).stack.tqh_first });
                        if !(unsafe { (*(*ps_5).scope).entry.tqe_next }).is_null() {
                            (unsafe {
                                (*(*ps_5).stack.tqh_first).entry.tqe_prev =
                                    &mut (*(*ps_5).scope).entry.tqe_next
                            });
                        } else {
                            (unsafe {
                                (*ps_5).stack.tqh_last = &mut (*(*ps_5).scope).entry.tqe_next
                            });
                        }
                        (unsafe { (*ps_5).stack.tqh_first = (*ps_5).scope });
                        (unsafe { (*(*ps_5).scope).entry.tqe_prev = &mut (*ps_5).stack.tqh_first });
                    }
                    (unsafe { (*ps_5).scope = scope_1 });
                }
                17 => {
                    let mut ps_6: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut scope_2: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
                    scope_2 = (unsafe { xmalloc(::core::mem::size_of::<cmd_parse_scope>() as u64) })
                        as *mut cmd_parse_scope;
                    (unsafe { (*scope_2).flag = ((*(*ps_6).scope).flag == 0) as i32 });
                    (unsafe { free((*ps_6).scope as *mut libc::c_void) });
                    (unsafe { (*ps_6).scope = scope_2 });
                }
                18 => {
                    let mut ps_7: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut scope_3: *mut cmd_parse_scope = std::ptr::null_mut::<cmd_parse_scope>();
                    scope_3 = (unsafe { xmalloc(::core::mem::size_of::<cmd_parse_scope>() as u64) })
                        as *mut cmd_parse_scope;
                    (unsafe {
                        (*scope_3).flag =
                            format_true((*(yystack.l_mark).offset(0 as i32 as isize)).token)
                    });
                    (unsafe { yyval.flag = (*scope_3).flag });
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                                as *mut libc::c_void,
                        )
                    });
                    (unsafe { free((*ps_7).scope as *mut libc::c_void) });
                    (unsafe { (*ps_7).scope = scope_3 });
                }
                19 => {
                    let mut ps_8: *mut cmd_parse_state = unsafe { &mut parse_state };
                    (unsafe { free((*ps_8).scope as *mut libc::c_void) });
                    (unsafe { (*ps_8).scope = (*ps_8).stack.tqh_first });
                    if !(unsafe { (*ps_8).scope }).is_null() {
                        if !(unsafe { (*(*ps_8).scope).entry.tqe_next }).is_null() {
                            (unsafe {
                                (*(*(*ps_8).scope).entry.tqe_next).entry.tqe_prev =
                                    (*(*ps_8).scope).entry.tqe_prev
                            });
                        } else {
                            (unsafe { (*ps_8).stack.tqh_last = (*(*ps_8).scope).entry.tqe_prev });
                        }
                        (unsafe {
                            *(*(*ps_8).scope).entry.tqe_prev = (*(*ps_8).scope).entry.tqe_next
                        });
                    }
                }
                20 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(3 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    }
                }
                21 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(6 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(4 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(4 as i32) as isize)).commands
                        });
                    }
                }
                22 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(4 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                    } else if (unsafe {
                        (*(yystack.l_mark).offset(-(1 as i32) as isize)).elif.flag
                    }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                    }
                }
                23 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(7 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(5 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(4 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else if (unsafe {
                        (*(yystack.l_mark).offset(-(4 as i32) as isize)).elif.flag
                    }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(-(4 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(5 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(5 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(4 as i32) as isize))
                                .elif
                                .commands
                        });
                    }
                }
                24 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(2 as i32) as isize)).flag }) != 0 {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.elif.flag = 0 as i32 });
                        (unsafe { yyval.elif.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    }
                }
                25 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(3 as i32) as isize)).flag }) != 0 {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                    } else if (unsafe { (*(yystack.l_mark).offset(0 as i32 as isize)).elif.flag })
                        != 0
                    {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.elif.flag = 0 as i32 });
                        (unsafe { yyval.elif.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                    }
                }
                26 => {
                    let mut ps_9: *mut cmd_parse_state = unsafe { &mut parse_state };
                    (unsafe { yyval.commands = cmd_parse_new_commands() });
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                            .arguments
                            .tqh_first
                    })
                    .is_null()
                        && ((unsafe { (*ps_9).scope }).is_null()
                            || (unsafe { (*(*ps_9).scope).flag }) != 0)
                    {
                        let fresh11 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                .entry
                                .tqe_next
                        };
                        *fresh11 = std::ptr::null_mut::<cmd_parse_command>();
                        let fresh12 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                .entry
                                .tqe_prev
                        };
                        *fresh12 = unsafe { (*yyval.commands).tqh_last };
                        (unsafe {
                            *(*yyval.commands).tqh_last =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).command
                        });
                        (unsafe {
                            (*yyval.commands).tqh_last =
                                &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                    .entry
                                    .tqe_next
                        });
                    } else {
                        cmd_parse_free_command(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).command
                        });
                    }
                }
                27 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                    });
                }
                28 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                    });
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_first
                    })
                    .is_null()
                    {
                        (unsafe {
                            *(*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_first
                        });
                        let fresh13 = unsafe {
                            &mut (*(*(*(yystack.l_mark).offset(0 as i32 as isize)).commands)
                                .tqh_first)
                                .entry
                                .tqe_prev
                        };
                        *fresh13 = unsafe { (*yyval.commands).tqh_last };
                        (unsafe {
                            (*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_last
                        });
                        let fresh14 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_first
                        };
                        *fresh14 = std::ptr::null_mut::<cmd_parse_command>();
                        let fresh15 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_last
                        };
                        *fresh15 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).commands).tqh_first
                        };
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                                as *mut libc::c_void,
                        )
                    });
                }
                29 => {
                    let mut ps_10: *mut cmd_parse_state = unsafe { &mut parse_state };
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                            .arguments
                            .tqh_first
                    })
                    .is_null()
                        && ((unsafe { (*ps_10).scope }).is_null()
                            || (unsafe { (*(*ps_10).scope).flag }) != 0)
                    {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        let fresh16 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                .entry
                                .tqe_next
                        };
                        *fresh16 = std::ptr::null_mut::<cmd_parse_command>();
                        let fresh17 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                .entry
                                .tqe_prev
                        };
                        *fresh17 = unsafe { (*yyval.commands).tqh_last };
                        (unsafe {
                            *(*yyval.commands).tqh_last =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).command
                        });
                        (unsafe {
                            (*yyval.commands).tqh_last =
                                &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).command)
                                    .entry
                                    .tqe_next
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        cmd_parse_free_command(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).command
                        });
                    }
                }
                30 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                    });
                }
                31 => {
                    let mut ps_11: *mut cmd_parse_state = unsafe { &mut parse_state };
                    (unsafe {
                        yyval.command = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_command>() as u64,
                        ) as *mut cmd_parse_command
                    });
                    (unsafe { (*yyval.command).line = (*(*ps_11).input).line });
                    (unsafe {
                        (*yyval.command).arguments.tqh_first =
                            std::ptr::null_mut::<cmd_parse_argument>()
                    });
                    (unsafe {
                        (*yyval.command).arguments.tqh_last =
                            &mut (*yyval.command).arguments.tqh_first
                    });
                }
                32 => {
                    let mut ps_12: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut arg: *mut cmd_parse_argument =
                        std::ptr::null_mut::<cmd_parse_argument>();
                    (unsafe {
                        yyval.command = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_command>() as u64,
                        ) as *mut cmd_parse_command
                    });
                    (unsafe { (*yyval.command).line = (*(*ps_12).input).line });
                    (unsafe {
                        (*yyval.command).arguments.tqh_first =
                            std::ptr::null_mut::<cmd_parse_argument>()
                    });
                    (unsafe {
                        (*yyval.command).arguments.tqh_last =
                            &mut (*yyval.command).arguments.tqh_first
                    });
                    arg = (unsafe {
                        xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_argument>() as u64,
                        )
                    }) as *mut cmd_parse_argument;
                    (unsafe { (*arg).type_0 = CMD_PARSE_STRING });
                    (unsafe {
                        (*arg).string = (*(yystack.l_mark).offset(0 as i32 as isize)).token
                    });
                    (unsafe { (*arg).entry.tqe_next = (*yyval.command).arguments.tqh_first });
                    if !(unsafe { (*arg).entry.tqe_next }).is_null() {
                        (unsafe {
                            (*(*yyval.command).arguments.tqh_first).entry.tqe_prev =
                                &mut (*arg).entry.tqe_next
                        });
                    } else {
                        (unsafe {
                            (*yyval.command).arguments.tqh_last = &mut (*arg).entry.tqe_next
                        });
                    }
                    (unsafe { (*yyval.command).arguments.tqh_first = arg });
                    (unsafe { (*arg).entry.tqe_prev = &mut (*yyval.command).arguments.tqh_first });
                }
                33 => {
                    let mut ps_13: *mut cmd_parse_state = unsafe { &mut parse_state };
                    let mut arg_0: *mut cmd_parse_argument =
                        std::ptr::null_mut::<cmd_parse_argument>();
                    (unsafe {
                        yyval.command = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_command>() as u64,
                        ) as *mut cmd_parse_command
                    });
                    (unsafe { (*yyval.command).line = (*(*ps_13).input).line });
                    (unsafe {
                        (*yyval.command).arguments.tqh_first =
                            std::ptr::null_mut::<cmd_parse_argument>()
                    });
                    (unsafe {
                        (*yyval.command).arguments.tqh_last =
                            &mut (*yyval.command).arguments.tqh_first
                    });
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_first
                    })
                    .is_null()
                    {
                        (unsafe {
                            *(*yyval.command).arguments.tqh_last =
                                (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_first
                        });
                        let fresh18 = unsafe {
                            &mut (*(*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments)
                                .tqh_first)
                                .entry
                                .tqe_prev
                        };
                        *fresh18 = unsafe { (*yyval.command).arguments.tqh_last };
                        (unsafe {
                            (*yyval.command).arguments.tqh_last =
                                (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_last
                        });
                        let fresh19 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments)
                                .tqh_first
                        };
                        *fresh19 = std::ptr::null_mut::<cmd_parse_argument>();
                        let fresh20 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_last
                        };
                        *fresh20 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments)
                                .tqh_first
                        };
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(0 as i32 as isize)).arguments
                                as *mut libc::c_void,
                        )
                    });
                    arg_0 = (unsafe {
                        xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_argument>() as u64,
                        )
                    }) as *mut cmd_parse_argument;
                    (unsafe { (*arg_0).type_0 = CMD_PARSE_STRING });
                    (unsafe {
                        (*arg_0).string = (*(yystack.l_mark).offset(-(1 as i32) as isize)).token
                    });
                    (unsafe { (*arg_0).entry.tqe_next = (*yyval.command).arguments.tqh_first });
                    if !(unsafe { (*arg_0).entry.tqe_next }).is_null() {
                        (unsafe {
                            (*(*yyval.command).arguments.tqh_first).entry.tqe_prev =
                                &mut (*arg_0).entry.tqe_next
                        });
                    } else {
                        (unsafe {
                            (*yyval.command).arguments.tqh_last = &mut (*arg_0).entry.tqe_next
                        });
                    }
                    (unsafe { (*yyval.command).arguments.tqh_first = arg_0 });
                    (unsafe {
                        (*arg_0).entry.tqe_prev = &mut (*yyval.command).arguments.tqh_first
                    });
                }
                34 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(2 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    }
                }
                35 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(4 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(3 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(3 as i32) as isize)).commands
                        });
                    }
                }
                36 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(3 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                    } else if (unsafe {
                        (*(yystack.l_mark).offset(-(1 as i32) as isize)).elif.flag
                    }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize))
                                .elif
                                .commands
                        });
                    }
                }
                37 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(5 as i32) as isize)).flag }) != 0 {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(4 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(3 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else if (unsafe {
                        (*(yystack.l_mark).offset(-(3 as i32) as isize)).elif.flag
                    }) != 0
                    {
                        (unsafe {
                            yyval.commands = (*(yystack.l_mark).offset(-(3 as i32) as isize))
                                .elif
                                .commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(4 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe {
                            yyval.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(4 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(3 as i32) as isize))
                                .elif
                                .commands
                        });
                    }
                }
                38 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(1 as i32) as isize)).flag }) != 0 {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.elif.flag = 0 as i32 });
                        (unsafe { yyval.elif.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                        });
                    }
                }
                39 => {
                    if (unsafe { (*(yystack.l_mark).offset(-(2 as i32) as isize)).flag }) != 0 {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                    } else if (unsafe { (*(yystack.l_mark).offset(0 as i32 as isize)).elif.flag })
                        != 0
                    {
                        (unsafe { yyval.elif.flag = 1 as i32 });
                        (unsafe {
                            yyval.elif.commands =
                                (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                    } else {
                        (unsafe { yyval.elif.flag = 0 as i32 });
                        (unsafe { yyval.elif.commands = cmd_parse_new_commands() });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                        });
                        cmd_parse_free_commands(unsafe {
                            (*(yystack.l_mark).offset(0 as i32 as isize)).elif.commands
                        });
                    }
                }
                40 => {
                    (unsafe {
                        yyval.arguments = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_arguments>() as u64,
                        ) as *mut cmd_parse_arguments
                    });
                    (unsafe {
                        (*yyval.arguments).tqh_first = std::ptr::null_mut::<cmd_parse_argument>()
                    });
                    (unsafe { (*yyval.arguments).tqh_last = &mut (*yyval.arguments).tqh_first });
                    let fresh21 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).argument)
                            .entry
                            .tqe_next
                    };
                    *fresh21 = unsafe { (*yyval.arguments).tqh_first };
                    if !(*fresh21).is_null() {
                        (unsafe {
                            (*(*yyval.arguments).tqh_first).entry.tqe_prev =
                                &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).argument)
                                    .entry
                                    .tqe_next
                        });
                    } else {
                        (unsafe {
                            (*yyval.arguments).tqh_last =
                                &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).argument)
                                    .entry
                                    .tqe_next
                        });
                    }
                    (unsafe {
                        (*yyval.arguments).tqh_first =
                            (*(yystack.l_mark).offset(0 as i32 as isize)).argument
                    });
                    let fresh22 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).argument)
                            .entry
                            .tqe_prev
                    };
                    *fresh22 = unsafe { &mut (*yyval.arguments).tqh_first };
                }
                41 => {
                    let fresh23 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).argument)
                            .entry
                            .tqe_next
                    };
                    *fresh23 = unsafe {
                        (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_first
                    };
                    if !(*fresh23).is_null() {
                        let fresh24 = unsafe {
                            &mut (*(*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments)
                                .tqh_first)
                                .entry
                                .tqe_prev
                        };
                        *fresh24 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).argument)
                                .entry
                                .tqe_next
                        };
                    } else {
                        let fresh25 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_last
                        };
                        *fresh25 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).argument)
                                .entry
                                .tqe_next
                        };
                    }
                    let fresh26 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_first
                    };
                    *fresh26 = unsafe { (*(yystack.l_mark).offset(-(1 as i32) as isize)).argument };
                    let fresh27 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).argument)
                            .entry
                            .tqe_prev
                    };
                    *fresh27 = unsafe {
                        &mut (*(*(yystack.l_mark).offset(0 as i32 as isize)).arguments).tqh_first
                    };
                    (unsafe {
                        yyval.arguments = (*(yystack.l_mark).offset(0 as i32 as isize)).arguments
                    });
                }
                42 => {
                    (unsafe {
                        yyval.argument = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_argument>() as u64,
                        ) as *mut cmd_parse_argument
                    });
                    (unsafe { (*yyval.argument).type_0 = CMD_PARSE_STRING });
                    (unsafe {
                        (*yyval.argument).string =
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                    });
                }
                43 => {
                    (unsafe {
                        yyval.argument = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_argument>() as u64,
                        ) as *mut cmd_parse_argument
                    });
                    (unsafe { (*yyval.argument).type_0 = CMD_PARSE_STRING });
                    (unsafe {
                        (*yyval.argument).string =
                            (*(yystack.l_mark).offset(0 as i32 as isize)).token
                    });
                }
                44 => {
                    (unsafe {
                        yyval.argument = xcalloc(
                            1 as i32 as size_t,
                            ::core::mem::size_of::<cmd_parse_argument>() as u64,
                        ) as *mut cmd_parse_argument
                    });
                    (unsafe { (*yyval.argument).type_0 = CMD_PARSE_COMMANDS });
                    (unsafe {
                        (*yyval.argument).commands =
                            (*(yystack.l_mark).offset(0 as i32 as isize)).commands
                    });
                }
                45 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                    });
                }
                46 => {
                    (unsafe {
                        yyval.commands = (*(yystack.l_mark).offset(-(2 as i32) as isize)).commands
                    });
                    if !(unsafe {
                        (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands).tqh_first
                    })
                    .is_null()
                    {
                        (unsafe {
                            *(*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                    .tqh_first
                        });
                        let fresh28 = unsafe {
                            &mut (*(*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first)
                                .entry
                                .tqe_prev
                        };
                        *fresh28 = unsafe { (*yyval.commands).tqh_last };
                        (unsafe {
                            (*yyval.commands).tqh_last =
                                (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                    .tqh_last
                        });
                        let fresh29 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first
                        };
                        *fresh29 = std::ptr::null_mut::<cmd_parse_command>();
                        let fresh30 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_last
                        };
                        *fresh30 = unsafe {
                            &mut (*(*(yystack.l_mark).offset(-(1 as i32) as isize)).commands)
                                .tqh_first
                        };
                    }
                    (unsafe {
                        free(
                            (*(yystack.l_mark).offset(-(1 as i32) as isize)).commands
                                as *mut libc::c_void,
                        )
                    });
                }
                _ => {}
            }
            (unsafe { yystack.s_mark = (yystack.s_mark).offset(-(yym as isize)) });
            yystate = unsafe { *yystack.s_mark };
            (unsafe { yystack.l_mark = (yystack.l_mark).offset(-(yym as isize)) });
            yym = unsafe { yylhs[yyn as usize] };
            if yystate == 0 as i32 && yym == 0 as i32 {
                yystate = 4 as i32;
                (unsafe { yystack.s_mark = (yystack.s_mark).offset(1) });
                (unsafe { *yystack.s_mark = 4 as i32 });
                (unsafe { yystack.l_mark = (yystack.l_mark).offset(1) });
                (unsafe { *yystack.l_mark = yyval });
                if (unsafe { yychar }) < 0 as i32 {
                    (unsafe { yychar = yylex() });
                    if (unsafe { yychar }) < 0 as i32 {
                        (unsafe { yychar = 0 as i32 });
                    }
                }
                if (unsafe { yychar }) != 0 as i32 {
                    continue;
                }
                yyresult = 0 as i32;
                current_block = 3178910365268327865;
                break;
            } else {
                yyn = unsafe { yygindex[yym as usize] };
                if yyn != 0 as i32
                    && {
                        yyn += yystate;
                        yyn >= 0 as i32
                    }
                    && yyn <= 277 as i32
                    && (unsafe { yycheck[yyn as usize] }) == yystate
                {
                    yystate = unsafe { yytable[yyn as usize] };
                } else {
                    yystate = unsafe { yydgoto[yym as usize] };
                }
                if (unsafe { yystack.s_mark }) >= (unsafe { yystack.s_last })
                    && yygrowstack(unsafe { &mut yystack }) == -(2 as i32)
                {
                    current_block = 17613755028756935485;
                    break;
                }
                (unsafe { yystack.s_mark = (yystack.s_mark).offset(1) });
                (unsafe { *yystack.s_mark = yystate });
                (unsafe { yystack.l_mark = (yystack.l_mark).offset(1) });
                (unsafe { *yystack.l_mark = yyval });
            }
        }
        match current_block {
            17613755028756935485 => {}
            3178910365268327865 => {}
            _ => {
                yyresult = 1 as i32;
                current_block = 3178910365268327865;
            }
        }
    }
    match current_block {
        17613755028756935485 => {
            (unsafe { yyerror(b"yacc stack overflow\0" as *const u8 as *const i8) });
            yyresult = 2 as i32;
        }
        _ => {}
    }
    return yyresult;
}
